Announcement

Collapse
No announcement yet.

Math Class

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

  • Math Class

    Please help me with this problem, I would like to be able to solve for each of the segments given x and the number of sides of a regular polygon. Any ideas?



    Thanks
    Eric Boer
    Dev


  • #2
    x*(a-b)² ???
    LunarStudio Architectural Renderings
    HDRSource HDR & sIBL Libraries
    Lunarlog - LunarStudio and HDRSource Blog

    Comment


    • #3
      It's simple:

      a = x * [ sin( pi/(2*n) * 1 ) - sin( pi/(2*n) * 0 ) ] = x * sin( pi/(2*n) * 1 ) - 0
      b = x * [ sin( pi/(2*n) * 2 ) - sin( pi/(2*n) * 1 ) ] = x * sin( pi/(2*n) * 2 ) - a
      c = x * [ sin( pi/(2*n) * 3 ) - sin( pi/(2*n) * 2 ) ] = x * sin( pi/(2*n) * 3 ) - a - b
      d = x * [ sin( pi/(2*n) * 4 ) - sin( pi/(2*n) * 3 ) ] = x * sin( pi/(2*n) * 4 ) - a - b - c
      e = x * [ sin( pi/(2*n) * 5 ) - sin( pi/(2*n) * 4 ) ] = x * sin( pi/(2*n) * 5 ) - a - b - c - d
      etc.

      n ... number of segments (5 in the example above)

      I hope you see the general rule in it...

      Comment


      • #4
        I dont know if I believe it but Ill take your word for it lol. Now how are you getting pi from a shape that obviously does not have any smooth radius?
        LunarStudio Architectural Renderings
        HDRSource HDR & sIBL Libraries
        Lunarlog - LunarStudio and HDRSource Blog

        Comment


        • #5
          Originally posted by jujubee
          Now how are you getting pi from a shape that obviously does not have any smooth radius?
          "pi/2" is the same as 90 degrees
          For it is the angles that matters here...

          Comment


          • #6
            Thanks Dusan! Makes sense now, I was close but couldn't put it all together. Soon we will have a script to extrude polys with a nice round bevel.
            Eric Boer
            Dev

            Comment


            • #7
              Originally posted by Dusan_Pavlicek
              "pi/2" is the same as 90 degrees
              not trying to through a wrench into the works, I admit my math skills are rough, but doesn't that mean a+b+c+d+e = pi/2 or, in other words, the length adjacent(perpendicular) to x would always have to be less than or equal to pi/2?

              Comment


              • #8
                I seems I am missing something, all of the expressions come out equal for me . I think it is on the right track though. I have an idea of another way to approach it. Have to see if I can make it work
                Eric Boer
                Dev

                Comment


                • #9
                  Well here is what I came up with:

                  a = 2*x * sin(180/n) * cos(180/n)
                  b = 2*x * sin(180/n) * cos(3*(180/n))
                  c = 2*x * sin(180/n) * cos(5*(180/n))
                  d = 2*x * sin(180/n) * cos(7*(180/n))
                  e = 2*x * sin(180/n) * cos(9*(180/n))

                  It's in max script so it is a bit ugly
                  Eric Boer
                  Dev

                  Comment


                  • #10
                    RErender:

                    I double-checked and tested my equations again and everything works perfect!
                    Consider your image above:

                    x = approx. 376 pixels
                    n = 5
                    then
                    a = x * sin( pi/(2*n) * 1 ) - 0 = 376 * sin(pi/10 * 1) - 0 = 116 (ok)
                    b = x * sin( pi/(2*n) * 2 ) - a = 376 * sin(pi/10 * 2) - 116 = 105 (ok)
                    c = x * sin( pi/(2*n) * 3 ) - a - b = 376 * sin(pi/10 * 3) - 116 - 105 = 83 (ok)
                    etc.

                    or (the other form)

                    a = x * [ sin( pi/(2*n) * 1 ) - sin( pi/(2*n) * 0 ) ] = 376 * [ sin( pi/10 * 1 ) - sin( pi/10 * 0 ) ] = 116 (ok)
                    b = x * [ sin( pi/(2*n) * 2 ) - sin( pi/(2*n) * 1 ) ] = 376 * [ sin( pi/10 * 2 ) - sin( pi/10 * 1 ) ] = 105 (ok)
                    etc.

                    The equations you mentioned give incorrect results:
                    a = 2*x * sin(180/n) * cos(180/n) = 2 * 376 * sin(180/5) * cos(180/5) = 358 (incorrect - that's almost as much as x !)
                    b = 2*x * sin(180/n) * cos(3*(180/n)) = 2 * 376 * sin(180/5) * cos(3*(180/5)) = -137 (obviously incorrect )
                    etc.

                    pog:
                    a + b + c + d + e = x, not pi/2
                    also: a, b, c, d, e, x are lengths (in pixels, meters etc.) while pi/2 is an angle (in radians) - so the units differ and you can neither add them together nor compare them

                    Comment


                    • #11
                      Ok, I'm a believer, something must of gone wrong when I converted your equations to script.

                      Woops, My equation is set where n = all the sides of the polygon, works if n= n/4


                      I think my method will be easier to include in a scripted loop, and I apologize for saying you were wrong
                      Eric Boer
                      Dev

                      Comment


                      • #12

                        Comment

                        Working...
                        X