Grasshopper

algorithmic modeling for Rhino

How might I sort random points in a plane by their angle from the plane's U vector in a clockwise (or counter clockwise) direction?

Or more precisely, sorting the angle between the vectors created by each of these random points from the plane's origin and the U vector.

 

Views: 7819

Replies to This Discussion

You need to compute the vector angle between the plane X-axis and the plane origin -> point vector. Furthermore you need to compute this angle in 2D, as that's the only way you'll get a full circle angle (in 3D, only half circle angles are possible).

 

Then you can sort the angles while sorting the point in parallel. See attached.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

That is exactly what I did, expecting that the Vector Angle component would product a full circle angle given a plane. I must have fed the wrong string because all I was getting were half circle angles.

Thanks for bringing me back to that component. It performs well if it's fed well.

Also have a look at this method: http://www.grasshopper3d.com/forum/topics/perimeter-sort

You could also put a circle on the centroid of the bounding box and use that as the boundary curve for the linked method.

I really like using the Vector Angle component as it was intended. But after my hooking it up wrong and not realizing it, I came up with this nice alternate for the mean time:

 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service