Divide surface into two equal areas


I tried to search for solution, but seems this problem is quite difficult, and there might not be a good solution.

I want to calculate plastic resistance of cross section, to do it, I need to divide cross section into two equal halves by area, afterwards determine distance between centers of these areas.


Currently best approximation, I could figure out, would be to divide the cross section in 1mm heigh sections, then add each of them together till I reach half of the area. That would determine aproximate axis where the division should be.

I’m worried, that might be too resource intensive to do at once for ~15’000 cross sections.
Other option was doing it by mathematical formulas, but that would work only for specific cross sections, I’d love to see, if there was a possibility of doing it graphically.

Best regards,

Hi @janis.goldmanis,

You can use the evolutionary solver Galapagos that comes with Grasshopper to attack these kind of tasks. Be warned though, there might not always be a situation where the areas of both cross sections are exactly equal.

I this case it optimises the fitness value to be as close as possible to 0.0.

I also invite you to study this carefully, especially part 3.

galapagos.gh (13.1 KB)

Hi, Galapagos and Octopus are my go-to solutions normally, but in this case I need to do it simultaneously for 10-100k cross sections.

(I’m not even sure how to best set it up in that case. either using Anemone to loop through each cross section, or using gene pool of 100k sliders.)

Splitter.gh (13.0 KB)

Check it out. I think this is what you are looking for.

1 Like

I went down the Anemone route - it moves the cutting line succesively up/down depending on which half is bigger. And stops when all the halves are better than a given difference in area

200404 Equal Half Cross Sections.gh (17.0 KB)

If you have 10-100k cross sections than you need fast code to do the job. At the same time you have to decide what precision/tolerance is acceptable for your solution. I attached multitask solution that is based on principle of binary search algorithm. It process 1000 of cross sections with tolerance 0.001 in 7 seconds. Speed of execution also depends on number of cores you have installed on PC …

EqualSplittSurface_v1.gh (1.9 MB)


If you can split the shape to 4 rectangles you can find the exact position of the line

C = (S+(B-A)/2)/2

1 Like