Grasshopper

algorithmic modeling for Rhino

Vertices of Six-Sided Polygons from Planar Points Coordinates ?

Hi guys,

 

Would there be a way to draw six-sided polygons from a list of random planar points' coordinates or index, the points being the polygons' vertices ? 

 

Many thanks,

 

Arthur

Views: 1789

Replies to This Discussion

Is it any six points or do they have to be close together?
As close as possible. Some points might even be ignored ?

Hi Arthur,

 

sorry, are you asking how to connect six randomly placed points in a clockwise (counter-clockwise?) fashion?

 

If your points are always convex, you can use Convex Hull, otherwise you'll have to find a way to sort them.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

See attached for sorting points counter-clockwise around the average coordinate.

 

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Thanks a lot David,

Is it possible to apply a similar logic when dealing with large lists of points ?

 

Sure, this code works for 2 or more points, no matter how many you supply.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks David,

Sorry I meant forming several six-sided polygons from a random list of points.

 

 

 

It will only generate a single polygon per point-list, so if you supply your points in lists of six, it will work as expected I think.

 

Do note I'm using the World XY plane to measure vector angles, you may need to change that to match your points.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David, 

I have four points and the above formula does not work for me. It possible that it does not work in some cases? Actually I cannot attach the files. When I am trying to attch the files, I get

500: Unexpected Error

in chrome.

Some where in there are a set of none overlapping polygons. But this is as far as I've got. It might prompt someone else to do something better.

 

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service