HP Forums

Full Version: Volume of a bead with square hole- Program approach?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Description

1 - We have sphere of radius R with rectangular prism removed from it. Centerline of prism includes center of sphere.

[Image: SScLWlp.png]

2 - Length of one side (along x axis) of rectangle is a length of another side (along y axis) is b.

3 - The following schematic represents cross-sections of sphere with the void in 3 planes.
[Image: 2Cz5LEM.png]


The problem is to find the volume of sphere with the rectangular prism removed through center.

Solution

1 - Volume is found by subtracting volume of prism with spherical top and bottom from volume of sphere.

\( V=V_{sphere}-V_{prism}=\frac{4}{3}\,\pi \, r^{3}-V_{prism} \)

2 - The prism volume can be found by integration. For this purpose, let's divide the prism in 8 parts of equal volume the same way the simple prism is divided.

[Image: tTskpKW.png]


3 - The volume of part of prism with spherical ends can be found by integrating equation which describes upper part of sphere’s surface (the one which has positive z coordinates). The equation in Descartes coordinates is z(x,y)=√(r^2-x^2-y^2 ), assuming that sphere center is point 0,0,0. So we can write:

Descartes coordinates \( z(x,y)=\sqrt{r^2-x^2-y^2} \)

\( V_{prism}=8\int_{0}^{\frac{b}{2}}\int_{0}^{\frac{a}{2}}\sqrt{r^2-x^2-y^2}\,dx\,dy \)


\( V_{prism}=4\int_{0}^{\frac{b}{2}}(r^2-y^2)\,arcsin\left (\frac{a}{2\sqrt{r^2-y^2}} \right )\,dy\,+2a\int_{0}^{\frac{b}{2}}\sqrt{r^2-\frac{a^2}{4}-y^2}\,\,dy \)


\( V_{prism} = 4\int_{0}^{\frac{b}{2}}\left ( r^2-y^2 \right )\,arcsin\left ( \frac{a}{2\sqrt{r^2-y^2}} \right )\,dy\,+\,\frac{a}{4}\left ( 4r^2-a^2 \right )arcsin\left ( \frac{b}{\sqrt{4r^2-a^2}} \right )\,+\,\frac{ab}{4}\sqrt{4r^2-a^2-b^2} \)


4 - The integral in the right side of equation above can be represented as:

\( \int_{0}^{\frac{b}{2}}\left ( r^2-y^2 \right )\,arcsin\,\left ( \frac{a}{2\sqrt{r^2-y^2}} \right )\,dy \)

Next part will take time and I'm not sure I can do it.


Also, unsure if this is correct but it gets us going in a direction. I wanted to push this out to get opinions. I will rework through this several more times and see what I come up with.

Best way to proceed on a program like this with Free42/DM42? Hoping for Werner and Albert to chime in.
Hi, DM48

Very nice graph !

I would try something concrete, say R=10, a=b=2

Rough estimating the square hole volume, we have (a*b)*(2*R) = 80 (over-estimated)

Now, assuming the hole is circular, with radius r = 1, h = sqrt(R^2-r^2)

Circular hole volume (bead formula) = 4/3 pi (R^3 - h^3) ≈ 62.674510653

Scale-up the hole to rectangular, by 4/pi, we have 79.7996654104
This number should still be over-estimated ...

For lower bound, we do a rectangular column = (a*b)*(2*h) ≈ 79.5989949685

Hole volume should be inside range = (79.5989949685, 79.7996654104) ≈ 79.699 ± 0.100
Code:
function hv2(r,a,b)     -- assumed (2r)^2 >= a^2 + b^2
    local a2, b2, r2 = a*a, b*b, r*r
    local k2 = 4*r2 - (a2 + b2)
    local k = sqrt(k2)
    local d = a2*(k2-b2) + k2*(k2+b2)
    return a*b*k/3
         - 4/3*r2*r * atan2(4*a*b*k*r, d)
         + a * (r2-a2/6+r2) * atan2(b, k) 
         + b * (r2-b2/6+r2) * atan2(a, k)
end

lua> hv2(10,2,2)
79.73270765594205
lua> hv2(10,2,4)
158.65795312357352
lua> hv2(10,2,8)
310.69959533330837
lua> hv2(10,2,16)
561.679011610526

Update: replaced atan(y/x) with atan2(y, x)
(06-06-2020 10:43 PM)DM48 Wrote: [ -> ]\( V_{prism} = 4\int_{0}^{\frac{b}{2}}\left ( r^2-y^2 \right )\,arcsin\left ( \frac{a}{2\sqrt{r^2-y^2}} \right )\,dy\,+\,\frac{a}{4}\left ( 4r^2-a^2 \right )arcsin\left ( \frac{b}{\sqrt{4r^2-a^2}} \right )\,+\,\frac{ab}{4\sqrt{4r^2-a^2-b^2}} \)

Last term were off, \(\sqrt{4r^2-a^2-b^2}\) should up in the numerator
Albert, thank you. I have updated the post to fix the error.
Working this another way, I will post my notes soon, I get a total volume of 4109.057 in^3 if the sphere has a radius of 10", and the rectangle is 2" x 2".


-----

If you ignore the round edges on the hole, Vsphere = 4188.79 in^3 and Vrect = 80 in^3 = 4108.79 in^3
I cheated, and solve with Mathematica.

This time, I scaled everything by 2, to eliminate the 8x in front of hole volume.

> f1 = Integrate[Sqrt[d^2-x^2-y^2],{x,0,a}]

\(\frac{a\,{\sqrt{-a^2 + d^2 - y^2}} -
d^2\,\arctan (\frac{a\,{\sqrt{-a^2 + d^2 - y^2}}}{a^2 - d^2 + y^2}) +
y^2\,\arctan (\frac{a\,{\sqrt{-a^2 + d^2 - y^2}}}{a^2 - d^2 + y^2})}{2}\)

> f2 = Integrate[f1, y] // Expand;
> f2 /. y -> 0 // Simplify       → 0
> f2 = f2 /. y -> b                (* dy is integrated from 0 to b *)

\(\frac{a\,b\,{\sqrt{-a^2 - b^2 + d^2}}}{3} \\
+ \frac{b^3\,\arctan (\frac{a\,{\sqrt{-a^2 - b^2 + d^2}}}{a^2 + b^2 - d^2})}{6}
- \frac{b\,d^2\,\arctan (\frac{a\,{\sqrt{-a^2 - b^2 + d^2}}}{a^2 + b^2 - d^2})}{2}\\
+ \frac{a^3\,\arctan (\frac{b\,{\sqrt{-a^2 - b^2 + d^2}}}{a^2 + b^2 - d^2})}{6}
- \frac{a\,d^2\,\arctan (\frac{b\,{\sqrt{-a^2 - b^2 + d^2}}}{a^2 + b^2 - d^2})}{2}\\ \\
- \frac{i}{6}\,d^3\,\log (\frac{6\,{\sqrt{-a^2 - b^2 + d^2}}}
{a\,d^3\,\left( -2\,b + 2\,d \right) } +
\frac{3\,i \,\left( -\left( a^2\,d \right) - b\,d^2 + d^3 \right) }
{a^2\,d^4\,\left( -b + d \right) }) +
\frac{i}{6}\,d^3\,\log (\frac{-6\,{\sqrt{-a^2 - b^2 + d^2}}}
{a\,\left( -2\,b - 2\,d \right) \,d^3} +
\frac{3\,i \,\left( -\left( a^2\,d \right) + b\,d^2 + d^3 \right) }
{a^2\,d^4\,\left( b + d \right)})\)

> f2 /. {d->20, a->2, b->2} // N       → 79.7327 + 0. I

f2 is already hole volume formula, but it is best if we simplify, and remove the imag. part.

log(z) = log(|z|) + i * args(z), args(z) = atan(z.imag / z.real)

> f3 = Part[f2,-2,-1,-1]     → \(\frac{6\,{\sqrt{-a^2 - b^2 + d^2}}}{a\,d^3\,\left( -2\,b + 2\,d \right) } +
\frac{3\,i \,\left( -\left( a^2\,d \right) - b\,d^2 + d^3 \right) }
{a^2\,d^4\,\left( -b + d \right)}\)

> f4 = Part[f2,-1,-1,-1]     → \(\frac{-6\,{\sqrt{-a^2 - b^2 + d^2}}}
{a\,\left( -2\,b - 2\,d \right) \,d^3} +
\frac{3\,i \,\left( -\left( a^2\,d \right) + b\,d^2 + d^3 \right) }
{a^2\,d^4\,\left( b + d \right) }\)

> t3 = Part[f3,2]/I / Part[f3,1] // Simplify     → \(\frac{-a^2 + d\,\left( -b + d \right) }{a\,{\sqrt{-a^2 - b^2 + d^2}}}\)

> t4 = Part[f4,2]/I / Part[f4,1] // Simplify     → \(\frac{-a^2 + d\,\left( b + d \right) }{a\,{\sqrt{-a^2 - b^2 + d^2}}}\)

Using identity, tan(x-y) = (tan(x) - tan(y)) / (1 + tan(x) tan(y)), combine tan(2 angles)

> t34 = (t3 - t4) / (1 + t3 t4) // Simplify      → \(\frac{2 a b d \sqrt{-a^2 - b^2 + d^2}}
{d^2 (b^2-d^2) + a^2 (b^2 + d^2)}\)

> hv = f2 - Part[f2,{-2,-1}] + d^3/6 ArcTan[t34] // Simplify

Result is still messy. Let k = √(d^2 - a^2 - b^2), and expanding √(k²) as k:

> hv2 = hv /. b^2 -> d^2 - a^2 - k^2 // Simplify // PowerExpand

\(\Large \frac{2abk\; -\; \left( b^3 - 3bd^2 \right) \arctan (\frac{a}{k})\;-\;
\left( a^3 - 3ad^2 \right)\arctan (\frac{b}{k})\;-\;
d^3\arctan (\frac{2abdk}
{a^4 + d^2k^2 + a^2\left( -d^2 + k^2 \right) })}{6}\)

> hv2 /. {a->2, b->2, d->20, k->Sqrt[400-4-4]} // N     → 79.7327
My new way is simpler I believe. I will type it in tonight. I admire the work you put into that LaTeX entry. :-)
How many Angels can dance on the surface of that square hole?
With and without social distancing.
Problem: What is the volume of a sphere of radius r, with a rectangular hole (with edge lengths x and y) passing through the center?

[Image: h4UN7Gd.png]
Figure 1: Cross-sections through the center of the sphere, with horizontal and vertical spherical caps and their intersections.
Solution. The remaining volume of the sphere, with the rectangular hole removed, can be calculated as follows

\( V = 2V_{1} + 2V_{2} - 4\left ( V_x + V_y \right ) \)

where \(V_1\), \(V_2\), \(V_x\) and \(V_y\) are the volumes corresponding to the cross-section areas in Figure 1.

With the formulas for the individual volumes derived in the following sections, and with \( b = \sqrt{r^2-\frac{x^2+y^2}{4}} \) , the formula for the total volume is

\(V = \frac{2\pi}{3}\left ( r-\frac{x}{2} \right )^2\left ( 2r+\frac{x}{2} \right )+\frac{2\pi}{3}\left ( r-\frac{y}{2} \right )^2\left ( 2r+\frac{y}{2} \right )-\frac{2bxy}{3}-\frac{8r^3}{3}\left ( arctan\left ( \frac{bx}{ry} \right )+arctan\left ( \frac{by}{rx} \right ) \right )-2x\left ( \frac{x^2}{12}-r^2 \right )arctan\left ( \frac{2b}{y} \right )-2y\left ( \frac{y^2}{12}-r^2 \right )arctan\left ( \frac{2b}{x} \right ) \)

[Image: GuWOAWM.png]
Figure 2: Cross-section through the center of the sphere, with α and d as in the paper

Volumes \(V_1\) and \(V_2\). \(V_1\) and \(V_2\) correspond to spherical caps (see e.g. Wikipedia
page on spherical caps
), with heights \( h_1 = r − \frac{x}{2} \) and \( h_2 = r − \frac{y}{2} \) , respectively. Their volumes are

\(V_1=\frac{\pi h_1^2}{3}\left ( 3r-h_1 \right )=\frac{\pi}{3}\left ( r-\frac{x}{2} \right )^2\left ( 2r+\frac{x}{2} \right )\)

\(V_2=\frac{\pi h_2^2}{3}\left ( 3r-h_2 \right )=\frac{\pi}{3}\left ( r-\frac{y}{2} \right )^2\left ( 2r+\frac{y}{2} \right )\)

Volumes \(V_x\) and \(V_y\). A formula for the volume of segments of this type was derived in Section 4.3 of the paper Exact calculation of the overlap volume of spheres and mesh elements by Severin Strobl, Arno Formella and Thorsten P ̈oschel (Journal of Computational Physics, Volume 311, 2016, link). The relevant section is inserted at the end of this document (Figure 3).

In our case, sin(α), cos(α) and d can be calculated by considering the small blue triangle (see Figure 2): The edge lengths of this triangle are x2 and y2 and the angle between them is a right angle, so

\(sin\left ( \alpha \right )=\frac{y}{2d}\;\;, cos\left( \alpha \right)=\frac{x}{2d}\;\; and\;\;d=\sqrt{\frac{x^2+y^2}{4}}\)

With these equations, we can translate the notation of equation (5) of the paper into terms involving only r, x and y (and, for simplicity of notation, b):

\(a=d\;sin\left ( \alpha \right )\;=\frac{y}{2}\;,\)

\(b = \sqrt{r^2-d^2}\;=\;\sqrt{r^2-\frac{x^2+y^2}{4}}\;,\)

\(c=d\;cos\left ( \alpha \right )=\;\frac{x}{2}\)

\(V_y=\frac{abc}{3}+a\left ( \frac{a^2}{3}-r^2 \right )arctan\left ( \frac{b}{c} \right )+\frac{2r^3}{3}arctan\left ( \frac{b\;sin\left( \alpha \right)}{r\;cos\left ( \alpha \right )} \right ) =\frac{bxy}{12}+\frac{y}{2}\left ( \frac{y^2}{12}-r^2 \right )arctan\left ( \frac{2b}{x} \right )+\frac{2r^3}{3}arctan\left ( \frac{by}{rx}\right )\)

with \(b = \sqrt{r^2-\frac{x^2+y^2}{4}}\)

By swapping x and y in the formula for Vy, we can derive the corresponding formula for \(V_x\):

\(V_x=\frac{bxy}{12}+\frac{x}{2}\left ( \frac{x^2}{12}-r^2 \right )arctan\left ( \frac{2b}{y} \right )+\frac{2r^3}{3}arctan\left ( \frac{bx}{ry}\right )\)

with \(b = \sqrt{r^2-\frac{x^2+y^2}{4}}\)

Relevant section (4.3) of Exact calculation of the overlap volume of spheres and mesh elements by Severin Strobl, Arno Formella and Thorsten Po ̈schel (Journal of Computational Physics, Volume 311, 2016, link)
This is fantastic.
A quick transcript to a 42 program:

Code:
00 { 180-Byte Prgm }
01▸LBL "RBV"
02 MVAR "R"
03 MVAR "X"
04 MVAR "Y"
05▸LBL 10
06 VARMENU "RBV"
07 RTN
08 RCL "X"
09 RCL "Y"
10 COMPLEX
11 ABS
12 2
13 ÷
14 RCL+ "R"
15 RCL "R"
16 LASTX
17 -
18 ×
19 SQRT
20 LSTO "b"
21 RCL "X"
22 XEQ 11
23 RCL "Y"
24 XEQ 11
25 +
26 PI
27 ×
28 RCL "b"
29 RCL× "X"
30 RCL× "Y"
31 -
32 RCL "X"
33 RCL÷ "Y"
34 XEQ 12
35 RCL "Y"
36 RCL÷ "X"
37 XEQ 12
38 +
39 RCL "R"
40 3
41 Y↑X
42 ×
43 4
44 ×
45 -
46 3
47 ÷
48 RCL "X"
49 RCL "Y"
50 XEQ 13
51 RCL "Y"
52 RCL "X"
53 XEQ 13
54 STO+ ST X
55 GTO 10
56▸LBL 11
57 2
58 ÷
59 RCL "R"
60 STO+ ST X
61 X<>Y
62 +
63 RCL "R"
64 LASTX
65 -
66 X↑2
67 ×
68 RTN
69▸LBL 12
70 RCL× "b"
71 RCL÷ "R"
72 ATAN
73 RTN
74▸LBL 13
75 RCL "b"
76 STO+ ST X
77 X<>Y
78 ÷
79 ATAN
80 X<>Y
81 STO× ST Y
82 X↑2
83 12
84 ÷
85 RCL "R"
86 X↑2
87 -
88 ×
89 -
90 END

XEQ "RBV"
10 R
2 X
2 Y
R/S -> 4109.05749713

RCL "R" 3 Y^X PI x 4 x 3 / X<>Y - -> 79.7327076559

Cheers, Werner
I'm glad I understand a lot more of your program. I am learning!

How can I set my calc to RAD and back to DEG from within a running program. Would be nice to have the program change to RAD before running if necessary, and then back to whatever it was. Clearing Flag 43 is not allowed, "Restricted Operation." Is this possible?

Reading through the program I see that Complex does more than make a Complex number. Smile It's also assembling a Matrix or Vector. ABS finds the magnitude of the Vector [ X Y]. Interesting! I didn't think about using Complex number formats to do that.
(06-10-2020 01:52 PM)DM48 Wrote: [ -> ]How can I set my calc to RAD and back to DEG from within a running program. Would be nice to have the program change to RAD before running if necessary, and then back to whatever it was.

The DEG, RAD and GRAD commands in the MODES menu are programmable.
(06-10-2020 01:58 PM)grsbanks Wrote: [ -> ]
(06-10-2020 01:52 PM)DM48 Wrote: [ -> ]How can I set my calc to RAD and back to DEG from within a running program. Would be nice to have the program change to RAD before running if necessary, and then back to whatever it was.

The DEG, RAD and GRAD commands in the MODES menu are programmable.

Thank you.
(06-10-2020 01:59 PM)DM48 Wrote: [ -> ]
(06-10-2020 01:58 PM)grsbanks Wrote: [ -> ]The DEG, RAD and GRAD commands in the MODES menu are programmable.

Thank you. I have to stop over thinking these things...

Especially as the 48S/SX/G/GX has the same ability Smile

The flags are, however, useful for determining programatically which mode is currently active.
(06-10-2020 02:06 PM)grsbanks Wrote: [ -> ]
(06-10-2020 01:59 PM)DM48 Wrote: [ -> ]Thank you. I have to stop over thinking these things...

Especially as the 48S/SX/G/GX has the same ability Smile

The flags are, however, useful for determining programatically which mode is currently active.

So true. Smile My minor tweak to Werner's program doing the calc in RAD and then switching back to degrees.


Code:
00 { 186-Byte Prgm }
01▸LBL "RBV"
02 MVAR "R"
03 MVAR "X"
04 MVAR "Y"
05▸LBL 10
06 VARMENU "RBV"
07 DEG
08 RTN
09 XEQ 14
10 RCL "X"
11 RCL "Y"
12 COMPLEX
13 ABS
14 2
15 ÷
16 RCL+ "R"
17 RCL "R"
18 LASTX
19 -
20 ×
21 SQRT
22 LSTO "b"
23 RCL "X"
24 XEQ 11
25 RCL "Y"
26 XEQ 11
27 +
28 PI
29 ×
30 RCL "b"
31 RCL× "X"
32 RCL× "Y"
33 -
34 RCL "X"
35 RCL÷ "Y"
36 XEQ 12
37 RCL "Y"
38 RCL÷ "X"
39 XEQ 12
40 +
41 RCL "R"
42 3
43 Y↑X
44 ×
45 4
46 ×
47 -
48 3
49 ÷
50 RCL "X"
51 RCL "Y"
52 XEQ 13
53 RCL "Y"
54 RCL "X"
55 XEQ 13
56 STO+ ST X
57 GTO 10
58▸LBL 11
59 2
60 ÷
61 RCL "R"
62 STO+ ST X
63 X<>Y
64 +
65 RCL "R"
66 LASTX
67 -
68 X↑2
69 ×
70 RTN
71▸LBL 12
72 RCL× "b"
73 RCL÷ "R"
74 ATAN
75 RTN
76▸LBL 13
77 RCL "b"
78 STO+ ST X
79 X<>Y
80 ÷
81 ATAN
82 X<>Y
83 STO× ST Y
84 X↑2
85 12
86 ÷
87 RCL "R"
88 X↑2
89 -
90 ×
91 -
92▸LBL 14
93 RAD
94 END
(06-09-2020 09:45 PM)Albert Chan Wrote: [ -> ]\(\Large \frac{2abk\; -\; \left( b^3 - 3bd^2 \right) \arctan (\frac{a}{k})\;-\;
\left( a^3 - 3ad^2 \right)\arctan (\frac{b}{k})\;-\;
d^3\arctan (\frac{2abdk}
{a^4 + d^2k^2 + a^2\left( -d^2 + k^2 \right) })}{6}\)

I just noticed the last big arctan mess can be simplified with half-angle formula

In[1]:= t = (a b) / (d k);
In[2]:= x = 2 t / (1 - t^2) // Simplify     → \(\frac{2\,a\,b\,d\,k}{-\left( a^2\,b^2 \right) + d^2\,k^2}\)

Numerator matched exactly, now check the denominator ...

In[3]:= Denominator[x] /. b^2 -> d^2 - a^2 - k^2 // Expand     → \(a^4 - a^2\,d^2 + a^2\,k^2 + d^2\,k^2\)

→ \(\arctan (\frac{2abdk}{a^4 + d^2k^2 + a^2\left( -d^2 + k^2 \right) })
= 2 \arctan \left({a b \over d k}\right)\) Smile

This is my revised Lua code. I use diameter this time, to match the quoted formula.

Code:
function hv2(d,a,b) -- sphere, rectanglar hole removed volume
    local d2, a2, b2 = d*d, a*a, b*b
    local k = sqrt(d2 - a2 - b2)    -- k >= 0
    return a*b*k/3
         - d*d2/3 * atan2(a*b, d*k)
         + a * (d2/2-a2/6) * atan2(b, k) 
         + b * (d2/2-b2/6) * atan2(a, k)
end

lua> hv2(20,2,2)
79.73270765594205
lua> hv2(20,2,4)
158.65795312357352
lua> hv2(20,2,8)
310.69959533330837
lua> hv2(20,2,16)
561.679011610526
And the corresponding 42-style program!
Since the formula has gotten relatively simple, I decided to go for a solver program:
Code:
00 { 106-Byte Prgm }
01▸LBL "RBV"
02 MVAR "D"
03 MVAR "A"
04 MVAR "B"
05 MVAR "V"
06 RCL "D"
07 X↑2
08 LSTO "D2"
09 RCL "A"
10 X↑2
11 -
12 RCL "B"
13 X↑2
14 -
15 SQRT
16 LSTO "K"
17 RCL "A"
18 RCL× "B"
19 STO× ST Y
20 RCL÷ "D"
21 RCL÷ "K"
22 ATAN
23 RCL× "D"
24 RCL× "D2"
25 -
26 3
27 ÷
28 RCL "A"
29 RCL "B"
30 XEQ 10
31 RCL- "V"
32 RCL "B"
33 RCL "A"
34▸LBL 10
35 RCL÷ "K"
36 ATAN
37 X<>Y
38 STO× ST Y
39 X↑2
40 3
41 ÷
42 RCL- "D2"
43 ×
44 2
45 ÷
46 -
47 END

Use with shift-SOLVER, select RBV, enter 3 values and then press the variable you want to solve for. For subsequent runs you need only enter the values that have changed.
For those who insist on typing it all in: do a 0 STO "var" for each variable used by the program (var=a,b,d,d2,k). Then you can select the variable from the menu when using STO etc.

Cheers, Werner
\(\frac{4}{3}+\left ( -2b^2\sqrt{a^2-2b^2}\;a^3\pi+2a^3\;arccot \left( \frac{a\sqrt{a^2-2b^2}}{b^2} \right)+2b\left(-3a^2+b^2 \right )arctan\left(\frac{b}{\sqrt{a^2-2b^2}} \right ) \right )\)

Another solution by someone else. This assumes (I think) a = radius of sphere and b = square dimension (no rectangle solution).
Hi, DM48

Dimensional analysis shows the formula is definitely wrong, with Length^6 for first term.
Yes, a = radius of sphere, but b was half the length of square.

I corrected your formula, and rewrite as volume of sphere - square hole

\(\frac{4}{3}\pi a^3 - \frac{8}{3}
\left (b^2\sqrt{a^2-2b^2}
-a^3\;arctan \left( \frac{b^2}{a\sqrt{a^2-2b^2}} \right)
+b\left(3a^2-b^2\right )arctan\left(\frac{b}{\sqrt{a^2-2b^2}} \right ) \right )\)

Note, formula for square hole, except for a factor of 8, is same as my code.
My formula doubled up all dimensions, diameter instead of radius, and length, width for rectangle.
Pages: 1 2
Reference URL's