Grasshopper

algorithmic modeling for Rhino

Hi! I have written a script which makes rectangles according to a select number of rules. The result of this script is a number of rectangles, which do or do not collide with each other. I have written the script to detect wether rectangles collide, or not, and for now the script deletes ALL rectangles which do collide. This is, however, not what I am trying to achieve.

My goal: if two rectangles collide, delete only ONE of the two rectangles. Let's say, for example, I only want the bigger (more area) of the two rectangles to remain, and automatically delete the smaller rectangle.

For now I've only been able to cull all colliding rectangle, leaving me with a very low number of rectangles as a result. I'd like to keep the amount of rectangles as high as possible, so only one of two colliding rectangles (the smallest) should be deleted.

I've included a (clean) rhino file and the grasshopper file. I've changed the colour of the module about my question in red.

Thank you!

Views: 701

Attachments:

Replies to This Discussion

Step 1. Sort your rectangles in such a way that the ones you'd like to keep in case in conflicts are earlier in the list.

Step 2. Solve the collision (you can collide curves, you don't have to use surfaces. It should have worked with rectangles, but it doesn't right now).

Step 3. Filter out all rectangles that don't collide at all.

Step 4. Filter out all rectangles that collide will earlier rectangles only. If the first collision happens with a later rectangle, then you can ignore it.

Attachments:

Thanks a lot! Also for clearing up my confusion with the collision of curves. For some reason it doesn't work with the rectangle curves.

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