# How to divide uneven surface (plot) by area

Hello!

I have already searched for similar solutions but nothing that I found was helping.

Here is my problem:
I have 3 different surfaces (plots) that I have to divide into smaller ones (500-800 m2). The new lines that divide smaller plots have to be at least 18m apart.
I have already divided the second surface by dividing upper curve with number 18 and conecting points to the curve below. Now I also have to add the area condition (500-800m2).

I would really appreciate it if someone would help me.

oppn.3dm (601.7 KB)

oppn.gh (8.8 KB)

you mean, you want to find out the small plots both meet both conditions that the edges of them are longer than 18m and area are in 500-800m2?

Yes. I would like to optimize to get as many small plots (500-800m2) as possible. And the edges must be away from each other at least 18m

I would like to get similar result as this:

Well â€¦ I have a thing that does that but itâ€™s via C# code (thus I guess thatâ€™s rather useless to you).

Anyway get it and letâ€™s hope that some good Samartitan does the same via native components.

Curve_RegionsInPairs_V1.3dm (51.3 KB)
Curve_RegionsInPairs_V1.gh (127.4 KB)

Thank you for sharing your solution. Iâ€™ve tried it, but it didnâ€™t work as I wanted it to. It didnâ€™t take the whole surface and some of the new plots were too small, but I liked the fact that areas were displayed.

Here how it works (as shown: last = false):

For each branch in cTree:
Given a pair of non null and valid curves (c1, c2):

1. Check the direction of the second (DotProduct on tangentAtStart) and reverse if DP<0.
2. Sort the curves (Length): c1 is the shortest, c2 the longest.
3. Divide by distance D both (or use the proportional [newly added] option for the longest).
4. Let c1divPtsCount the count of the points on the shortest.
5. Loop (c1divPtsCount - 1 times) and sample pairs of c1,c2 div points + c1, c2 div doubles and do the regions, centers, areas. Option last does the last region (may have odd shape).
6. Clear previous TDots (if any), do the TDot List and display it.

While this example perhaps doesnâ€™t fully capture your exact constraints, your problem does appear to be one that lends itself well to be solved with a generic solver, such as the standard Galapagos plugin. In this case, by dividing the perimeter into same sized plots by lines that travel perpendicular along a â€śspineâ€ť and searching the parameter space along the spine, minimising the plot area difference from a target average:

180830_PlotDivision_Galapagos_00.gh (12.4 KB)

4 Likes

Thank you so much. This is what I wanted to do.

1 Like

Awesome. I think you might be better off computing the fitness value like so, and using the annealing solver instead of the evolutionary solver (seems to get better results, especially with many plots):

180830_PlotDivision_Galapagos_01.gh (12.9 KB)

3 Likes

Thank you again. It works perfectly!

Is it maybe also possible to set the distance between lines to min 18m?

I havenâ€™t fully checked the final result from the model, but I think it covers all the criteria you are looking for. Although some of the divisions do get a little funky.

oppn_Rev1.gh (29.2 KB)

1 Like

It might be, although that could conflict with the area constraint/be impossible. A couple of options/ideas:

1. Make it part of the generative process (i.e. only allow the lines to move back and forth a little bit at predefined parameters along the spine curve).

2. Make it part of the fitness value (i.e. find and penalise cases where a distance drops below 18 m).

3. Use a multi-criteria optimisation solver to optimise towards both constraints (for instance Octopus).

4. Use Kangaroo2 instead, you might be able to implement both constraints here (i.e. the `PolygonArea` and `ClampLength` goals for instance).

1 Like

Iâ€™m not sure. What message do you get?

I get this when I want to open it:

What version of Grasshopper are you running? If youâ€™re still on Rhino5, then opening files saved on Rhino6 will sometimes result in missing components since GH on R6 has many new components that were not there before.

I have Rhion5 and Grasshopper 0.9.0076

I left the subtraction stuff in there by accident anyway, you shouldnâ€™t need it.

oppn_Rev2.gh (23.2 KB)

1 Like