Why is polar missing from the API?
-
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 ?
-
http://download.sketchup.com/sketchuphelp/gsu6_ruby/Docs/Ruby-Vector3d.html
will do it by combining a point, vector and distance....
-
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:
- Create a vector of the desired length and orientation
- Transform your points using the vector as the transformation
-
This plugin may help you understand...
-
@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:
- Create a vector of the desired length and orientation
- 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!
-
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.
Advertisement