Announcement

Collapse
No announcement yet.

Milling math

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Location: LA, CA, USA

    Comment


    • #3
      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, 05:39 PM.

      Comment


      • #4
        Thank you, much appreciated!

        Comment


        • #5
          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
          Lynn (Huntsville, AL)

          Comment


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

            Sent from my SM-G950U1 using Tapatalk

            Comment


            • #7
              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, 10:31 AM.

              Comment


              • #8
                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.

                Comment


                • #9
                  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, 12:12 PM.
                  Regards, Marv

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

                  Location: LA, CA, USA

                  Comment


                  • #10
                    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

                    Comment


                    • #11
                      ANNND- it works a treat, thank you, Marv Klotz! As to a cad program, they have their uses, but I punch up calculations on my workshop computer rather than booting a cad program and wading through that. And it's been a little hobby for many years to write these BASIC programs, mostly for my own entertainment. Thanks to all who replied!

                      Comment


                      • #12
                        Originally posted by rjs44032 View Post
                        Using my formula:

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

                        Best Regards,
                        Bob
                        Hmm, maybe we're speaking a different math language. Maybe my math skills have atrophied even more than I thought.

                        But to me if that line 360 degrees * pi/180 = radians is to be treated as a formula, then there is an implied coefficient of 1 in front of radians. Then multiplying both sides by 180 and dividing both sides by pi it becomes 360 degrees = 180/pi radians, ... which gives us: 360 degrees = 57.29 radians (????)

                        I think that's too many doggone radians.
                        Lynn (Huntsville, AL)

                        Comment


                        • #13
                          Originally posted by mklotz View Post
                          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.
                          Did you teach math in the Redding school district in CT? Because you sound just like my math teachers


                          Sent from my SM-G950U1 using Tapatalk

                          Comment


                          • #14
                            Originally posted by lynnl View Post
                            Hmm, maybe we're speaking a different math language. Maybe my math skills have atrophied even more than I thought.

                            But to me if that line 360 degrees * pi/180 = radians is to be treated as a formula, then there is an implied coefficient of 1 in front of radians. Then multiplying both sides by 180 and dividing both sides by pi it becomes 360 degrees = 180/pi radians, ... which gives us: 360 degrees = 57.29 radians (????)

                            I think that's too many doggone radians.
                            Ok. Perhaps this is better:

                            Let rVal = value in radians
                            Let dVal = value decimal degrees

                            Then use the following equations for conversion:

                            rVal = dVal(pi/180)
                            dVal = rVal(180/pi)

                            if dVal = 360 then rVal = 360(pi/180) = 360(0.017453293) = 6.283185307
                            if rVal = 6.283185307 then dVal = 6.283185307(180/pi) = 6.283185307(57.29577951) = 360

                            Hope this helps clarify. Sorry for the confusion. There was a typo in my previous response. 0.17453293 should have been 0.017453293.

                            I always think in logical terms and sometimes the point gets lost in the translation. That's why I am not a Math Professor.

                            Best Regards,
                            Bob
                            Last edited by rjs44032; 06-12-2019, 06:19 PM.

                            Comment

                            Working...
                            X