Grasshopper

algorithmic modeling for Rhino

Hello All,

I'am after a 'Conditional Function'.

I want a polygon with 'n' number of sides having an area as follows

1) area More than or Equal to 50sqm but Less than or Equal to 100Sqm

2) If Less than 50Sqm than 50Sqm

3) If More than 100Sqm than 100Sqm

Can any-1 help?

Kind regards,

AB

Views: 1018

Replies to This Discussion

I think the best way to approach this is to always scale the object, but use a scaling factor of 1.0 if the area is between the limits (L0 and L1). The algorithm would thus look like:

  1. Measure Area A of shape.
  2. Define target area At to be the same as A.
  3. If A is smaller than L0 then set At equal to L0.
  4. If A is larger than L1 then set At equal to L1.
  5. Compute the scaling factor F that is needed to go from A to At.

The scaling factor which changes the area from A to At incidentally is the square-root of the ratio of the two.

--

David Rutten

david@mcneel.com

Tirol, Austria

Attachments:

David,

Works great. 

Thank you so much for your help. Especially explaining the logic. Just 1 question, how did you get 

Scaling factor = square-root of the ratio?

thanks

AB

Well, scaling factors are basically the same as linear dimensions, i.e. length. Lengths are expressed in meters. Areas are expressed in meters-squared. So when you scale something with a factor 2, the area becomes 4 times bigger (and the volume 8 times as volumes are expressed in meters cubed).

Scaling lengths is quite straight-forward. If you have a curve that has a length of 10m and you want it to have a length of 15, you just divide 15 by 10, giving you 1.5 which is the scaling factor you need.

Since Areas have that square in there, you need to cancel it out by using a square-root. If you wanted to match a specific volume, then you need the cube-root of the ratio.

--

David Rutten

david@mcneel.com

Tirol, Austria

Thank you very much David

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