1. Senior Member
Join Date
Oct 2009
Location
South Florida
Posts
303

## Milling math

Does anyone know the formula for finding the circumscribed diameter of a polygon with an odd number of sides, given ONLY the distance from a flat side to the opposite vertex, and the number of sides?

I once wrote a little program in BASIC that finds all the needed info to mill polygons from bar stock (like boltheads) for polygons with an even number of sides -- pretty easy. But for the life of me can't make it work with an odd number. It can done --- math whiz Marv Klotz wrote a program on his website (polygon.exe) that does exactly this. He kindly posted the source code, but it's written in "C" and I have no clue how to read it.

I'd like to add this feature to my little program, but I need the formula, if anyone can assist, thanks!

2. Senior Member
Join Date
Mar 2001
Location
LA, CA, USA
Posts
1,044
Originally Posted by Video Man
Does anyone know the formula for finding the circumscribed diameter of a polygon with an odd number of sides, given ONLY the distance from a flat side to the opposite vertex, and the number of sides?

I once wrote a little program in BASIC that finds all the needed info to mill polygons from bar stock (like boltheads) for polygons with an even number of sides -- pretty easy. But for the life of me can't make it work with an odd number. It can done --- math whiz Marv Klotz wrote a program on his website (polygon.exe) that does exactly this. He kindly posted the source code, but it's written in "C" and I have no clue how to read it.

I'd like to add this feature to my little program, but I need the formula, if anyone can assist, thanks!
Extracted from POLYGON.C.

n = number of sides

ang=360./n;
ca=COS(0.5*ang);

dfv = distance from side to opposite vertex

r=dfv/(1.+ca) ; radius of circumscribed circle

Diameter of circumscribed circle = 2 * r

3. Member
Join Date
Oct 2018
Location
NE Ohio USA
Posts
48
Originally Posted by mklotz
Extracted from POLYGON.C.

n = number of sides

ang=360./n;
ca=COS(0.5*ang);

dfv = distance from side to opposite vertex

r=dfv/(1.+ca) ; radius of circumscribed circle

Diameter of circumscribed circle = 2 * r
Most programming logic works in radians not degrees. So you need to do a conversion when necessary (degrees * pi/180 = radians) and (radians * 180/pi = degrees). Hope this helps.

Best Regards,
Bob
Last edited by rjs44032; 06-11-2019 at 04:39 PM.

4. Senior Member
Join Date
Oct 2009
Location
South Florida
Posts
303
Thank you, much appreciated!

5. Senior Member
Join Date
Jan 2002
Location
Huntsville Ala
Posts
5,745
Originally Posted by rjs44032
Most programming logic works in radians not degrees. So you need to do a conversion when necessary (degrees * pi/180 = radians) and (radians * 180/pi = degrees). Hope this helps.

Best Regards,
Bob
That looks a little messed up to me. I think your 180/pi factor is upside down.
360 deg = 2pi radians ; or 180 deg = pi radians , so a deg = (pi radians)/180

6. Senior Member
Join Date
Mar 2015
Posts
3,265
It would take two seconds to find out in a CAD program

Sent from my SM-G950U1 using Tapatalk

7. Member
Join Date
Oct 2018
Location
NE Ohio USA
Posts
48
Originally Posted by lynnl
That looks a little messed up to me. I think your 180/pi factor is upside down.
360 deg = 2pi radians ; or 180 deg = pi radians , so a deg = (pi radians)/180
Using my formula:

360 degrees * pi/180 = radians
360 * 0.17453293 = 6.283185307 (in radians)

or commutative

1 degree = pi/180 So 360 degrees =

pi/180 * 360
0.17453293 * 360 = 6.283185307 (in radians)

Hope this helps.

Best Regards,
Bob
Last edited by rjs44032; 06-12-2019 at 09:31 AM.

8. Senior Member
Join Date
Dec 2008
Location
Kendal, On
Posts
1,650
Originally Posted by RB211
It would take two seconds to find out in a CAD program

Sent from my SM-G950U1 using Tapatalk
My math skills have suffered greatly over the years due to this. I sit at a desk for at least 50% of my day with cad at my finger tips. Area, volume, mass, trig, and any other type of math problem I used to solve with a pencil and calculator now gets solved with CAD. What used to be second nature to figure out with a calculator now gives me pause when trying to do it the old fashioned way because I have to try and remember how to do it. It's both a blessing and a curse.

9. Senior Member
Join Date
Mar 2001
Location
LA, CA, USA
Posts
1,044
Originally Posted by RB211
It would take two seconds to find out in a CAD program
And you would have learned exactly no math that would be useful in other applications.

Plus, had you learned some math, you could solve this problem in your head in two seconds...

The distance from the center of a flat to the opposing vertex (dfv) is clearly the sum of the distance from the center to the vertex, the radius (r) of the circumscribed circle, plus the apothem distance to the flat which is r times the cosine of the polygon half angle [360/(2N)].

Thus...

dfv = r * (1 + cos[360/(2N)])

or

r = dfv / (1 + cos[360/(2N)])

and the diameter is twice that.
Last edited by mklotz; 06-12-2019 at 11:12 AM.

10. Senior Member
Join Date
Mar 2015
Location
Central Ms
Posts
1,107
This kind of post reminds me of how old I am. I remember finding the solution with a slide rule.

Page 1 of 2 12 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•