sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Why is polar missing from the API?

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 498 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      tomot
      last edited by

      I have been wondering for some time now why polar was not included as a method in the SU Ruby API. The following quote is from a book by George O. Head, Titled AutoLisp in plain English.

      quote:

      Polar: derive point from angle and distance

      (polar) is a fascinating command, without it you wouldn't be able to do 80% of the things you want to do with angles. It produces a point at an angle and distance from another point. For example, if you need a point to be 14 feet from another point at an angle of 272 degrees, then (polar) is the command to use. Remember when using (polar), the angle you supply must be measured in radians, not degrees.

      (setq a (polar pnt1 ang1 dst1)

      Ifpnt1 is a point, ang1 is the angle and dst1 is the distance, then the variable a is assigned a point ang1 (angle) and dst1 (distance) from pnt1 (point). That's particularly useful when producing parallel lines at an angle and distance + or - 90 degrees from each other.

      Unquote:

      Is it possible to write a method using the existing SU API that would mimic the polar command as its used within Autolisp ?

      [my plugins](http://thingsvirtual.blogspot.ca/)
      tomot

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        http://download.sketchup.com/sketchuphelp/gsu6_ruby/Docs/Ruby-Vector3d.html
        will do it by combining a point, vector and distance...

        .

        TIG

        1 Reply Last reply Reply Quote 0
        • R Offline
          RickW
          last edited by

          One primary difference is that the polar method in AutoLISP assumes everything happens in the XY plane. That same assumption cannot be safely made in SketchUp. For example, given a point and an angle, in which plane should the angle be measured? And against what zero angle? The 3D nature of SketchUp increases the complexity of the situation a bit, but a coded solution is possible:

          1. Create a vector of the desired length and orientation
          2. Transform your points using the vector as the transformation

          RickW
          [www.smustard.com](http://www.smustard.com)

          1 Reply Last reply Reply Quote 0
          • M Offline
            Matt666
            last edited by

            This plugin may help you understand...

            Frenglish at its best !
            My scripts

            1 Reply Last reply Reply Quote 0
            • T Offline
              tomot
              last edited by

              @rickw said:

              One primary difference is that the polar method in AutoLISP assumes everything happens in the XY plane. That same assumption cannot be safely made in SketchUp. For example, given a point and an angle, in which plane should the angle be measured? And against what zero angle? The 3D nature of SketchUp increases the complexity of the situation a bit, but a coded solution is possible:

              1. Create a vector of the desired length and orientation
              2. Transform your points using the vector as the transformation

              I'm half way, to creating a coded solution.
              However, because the API has a + or - pushpull method, those that wrote the API didn't think a polar method was necessary. SU is no different than AutoCad in that respect. One is still drawing 2d objects on either xy, yz, xz planes. Its the pushpull or a polar method that leads to making 2d into 3d objects.

              my 2 cents!

              [my plugins](http://thingsvirtual.blogspot.ca/)
              tomot

              1 Reply Last reply Reply Quote 0
              • R Offline
                RickW
                last edited by

                A sloped roof doesn't lie in any of the 3 standard planes, so there's a quick exception, and was the kind of thing I was talking about. 😄 It is planar, but not orthogonal to the coordinate system. And a sloped roof on a wall at a 30 degree angle to the x axis compounds the issue...

                @tomot said:

                those that wrote the API didn't think a polar method was necessary.

                True, because they provided vectors and transformations. Polar is simply a kind of transformation.

                RickW
                [www.smustard.com](http://www.smustard.com)

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement