Grasshopper

algorithmic modeling for Rhino

For the purpose of scaling, is there a component that can find the centre point of any polygon?


Please see below quote.

component (Curve > Analysis > Centre) which gives me the centre of the circles. By
connecting it to the you can see that all circles would rescale in their level without movement.
- Quote from Khabasi

Views: 5556

Replies to This Discussion

The area component works fine if the polygon is closed and planar.
If it's not planar or closed, you can find it yourself by extracting the polygon vertices, separating their x,y,z values, finding the arithmetic mean for each of the 3 lists of numbers (using the mean component) and constructing a new point with the resulting 3 values.
thanks very much,

the polygon is not planar,

how do I extract the vertices is it 'curve>analysis>explode' component and how do I seperate their x,y,z values?

thanks
To extract the vertices you can use the Divide Curve component set to 1 segment and the split at kinks option enabled. To separate the x,y,z values use the Decompose component.


Hi Vicente, the triangle on left of picture is the curve I am trying to make a point at centre of, the definition on right is what I have tried but does not seem to be working.?????
Looks like Vicente took off...

But you should be working with points (not vectors) and you'll want to find the arithmetic mean (AM) of the x, y and z components to then construct the centroid.

Alternatively if all your polygons are triangles (I'm not sure from your screengrab...) which are always planar you can create a surface to find the centroid.

-taz

taz - awesome thanks very much!!
Thanks for filling in. Btw, haven't you heard of spherical triangles? :P
hi, I think the question was not to me but anyway the polygons were not all triangles in this case.
What a great strain guys. I am finding this very helpful. I am trying to do the same thing for hexagons. Could you fill me in as to what the third operation is above? What is the green line with the arrow above it?

a
Here's another one, it computes the average of all the corners in a polyline (or just a list of points really). Mass addition on all the points, then divide by the number of points you have. Basically the regular Average formula:

A + B + C + D + E + ... + Z
────────────────────
             N

--
David Rutten
david@mcneel.com
Seattle, WA
Attachments:
When you shatter a closed curve the start and end verticies are the same. The green line with the arrow is [Shift List]. With the default shift settings (S=1, Wrap=False) the end point drops off so the same vertex isn't being counted twice.

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