Grasshopper

algorithmic modeling for Rhino

Hello all,

I am currently struggling to come up with an equation to maintain the parametricity of my system.

I have 2 polygons, one inside the other, but they do not share the same center. 

I need to scale/offset the bigger polygon, until the line connecting the mid points of the polygons closer side measures x distance, in this case 2875 units.

So I need an equation that gives as a result how much I need the polygon to grow in order to have that line measure 2875.

The only thing I imagine is galapagos, but that ruins the parametricity...

Views: 895

Attachments:

Replies to This Discussion

Provided the polygons are both CCW (and valid and closed and planar a.s.o.) you could:

1) Detect closest edge.
2) Draw a line from outer polygon centroid ('C') to its closest edge mid point.
3) Put a plane on inner polgons' closest edge mid point 'M'.
    Align the plane with closest edge.
4) Draw arc on the aligned plane, its radius being the wanted distance, the arc interval Pi To 2*Pi.
5) Intersect arc with line from step 2 to find point 'X'.
6) Divide the distance from C to X by the distance from C to M to get the scaling factor you are after.

Wow, beautiful, thank you so much!

How do you came up with this? I wish they would teach me how to solve these kind of problems.

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