Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Milling math

  1. #1
    Join Date
    Oct 2009
    Location
    South Florida
    Posts
    303

    Default 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. #2
    Join Date
    Mar 2001
    Location
    LA, CA, USA
    Posts
    1,045

    Default

    Quote Originally Posted by Video Man View Post
    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
    Regards, Marv

    Home Shop Freeware - Tools for People Who Build Things
    http://www.myvirtualnetwork.com/mklotz

  3. #3
    Join Date
    Oct 2018
    Location
    NE Ohio USA
    Posts
    51

    Default

    Quote Originally Posted by mklotz View Post
    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. #4
    Join Date
    Oct 2009
    Location
    South Florida
    Posts
    303

    Default

    Thank you, much appreciated!

  5. #5
    Join Date
    Jan 2002
    Location
    Huntsville Ala
    Posts
    5,756

    Default

    Quote Originally Posted by rjs44032 View Post
    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. #6
    Join Date
    Mar 2015
    Posts
    3,327

    Default

    It would take two seconds to find out in a CAD program

    Sent from my SM-G950U1 using Tapatalk

  7. #7
    Join Date
    Oct 2018
    Location
    NE Ohio USA
    Posts
    51

    Default

    Quote Originally Posted by lynnl View Post
    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)

    Using your formula:

    360 degrees = 2pi radians
    360 = 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. #8
    Join Date
    Dec 2008
    Location
    Kendal, On
    Posts
    1,659

    Default

    Quote Originally Posted by RB211 View Post
    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. #9
    Join Date
    Mar 2001
    Location
    LA, CA, USA
    Posts
    1,045

    Default

    Quote Originally Posted by RB211 View Post
    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.
    Regards, Marv

    Home Shop Freeware - Tools for People Who Build Things
    http://www.myvirtualnetwork.com/mklotz

  10. #10
    Join Date
    Mar 2015
    Location
    Central Ms
    Posts
    1,129

    Default

    This kind of post reminds me of how old I am. I remember finding the solution with a slide rule.
    “I know lots of people who are educated far beyond their intelligence”

    Lewis Grizzard

Posting Permissions

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