• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Why is polar missing from the API?

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 4 Posters 498 Views
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 2 Oct 2008, 17:02

    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
    • T Offline
      TIG Moderator
      last edited by 2 Oct 2008, 17:58

      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 2 Oct 2008, 18:05

        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 2 Oct 2008, 18:16

          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 3 Oct 2008, 18:38

            @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 3 Oct 2008, 21:12

              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
              1 / 1
              • First post
                1/6
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement