Grasshopper

algorithmic modeling for Rhino

i  am trying galapagos to divide a rectangle in 3 different areas with certain percentage each, using lines vertical to a certain line. For instance i set to divide the rectangle in 3 areas: 44%, 39% and 17% using the 2 vertical lines. The galapagos works  well, finds the solution. Is there a way for galapagos to sort them also, so for example, the area 44% to be the first from the left, the area 39% to be second from the left and the area 17% the third?
As you can see it sorts the three areas randomly (here the 17% area was placed in the middle and not in the right)



this is the rectangle

this is the ghx file

Views: 505

Replies to This Discussion

Can you post the actual file I can't work it out from the scaled down screen shot.

I suspect the approach would be to create a list of numbers {44, 39, 17}, then find the absolute difference between the first area and the first number, the second area and the second number and the third are and the third number. For example, let's assume we have the following areas {65, 15, 20}. The absolute difference between these two sets equals {abs(44-65), abs(39-15), abs(17-20)} == {21, 24, 3}. The sum-total of all these absolute differences is your fitness, i.e. 21+24+3 = 48. This number has to go to zero.

If we enter the results you just got, then the absolute differences look like this: {abs(44-44), abs(39-17), abs(17-39)} == {0, 22, 22}, which results in a fitness of 44. Only an exact match will result in a fitness of zero.

--
David Rutten
david@mcneel.com
Seattle, WA
the files are
Attachments:
i will try your advice, thanks!
See attached. I changed you document quite a bit. I made it easier to add more sliders and area ratios. I also normalized the division sliders so they always result in valid slicing lines.

--
David Rutten
david@mcneel.com
Seattle, WA
Attachments:
Ah wait, the splitting result is not ordered along the base curve. I'll have to add some sorting to the output to make sure the order of surfaces matches the order of the ratios you specify...

--
David Rutten
david@mcneel.com
Seattle, WA
Added sorting to the Area Centroids.

--
David Rutten
david@mcneel.com
Seattle, WA
Attachments:
thanks! i will look into this

thank you for your time!

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