Divide surface based on corners


I would like to divide uneven surface based on corners/edges. Kindly see attached surface where I need to divide A to look like B. Would be great if it can be achieved with grasshopper. Is there any component or method I could do that. Tried using extend curve and heteroptera but gets weird with intersections in middle.

surface-partition.dwg (15.5 KB)


Your example “B)” is only one of many possible ways to divide surface “A)” based on corners/edges so, without additional criteria, the task is undefined.

1 Like

It can be any of the edges. Just like we do with extend curve component but with that component intersection happens in middle forming another rectangle/square. Am I asking it right ? or may I know what could other criteria?

As Joe says, the logic sequence to decide how to break up the areas appears simple, but perhaps is not. For example, do you extend all of the lines that are ‘interior’ to a convex curve until there is an intersection?
anyway, once the logic of extending lines is decided, then use components to extend lines, create a surface out of outline of all shapes (your figure A above), use extended lines to split the surface, then extract edge curves (explode BREP) of the surfaces.

1 Like

This is the problematic region:

It is an exception from the criteria you’re setting, You either get only rectangles or you don’t. If you don’t there are countless variations.

If you do. There are a several variations just due to this area.

1 Like

Ok how to make uniform rectangles?

Think it through!



You can also use other criteria, for example, a) you can look for largest possible rectangle with straight lines for other segments; b) rectangles closer to an attractor point and strips (long thin rectangles) further away,c) a rectangular tile packing after Laurent, and others.
Back to the straight line case, there is also another component, “geometric regions” which takes curve inputs and will give you closed curve regions (part of ‘Heteroptera’ plugin )

1 Like

Or look for minimal number of rectangles that will produce the input contour.

have done this before using heteroptera… its ok for now

div_srf_2019Jun16a.gh (19.3 KB)

Arbitrary perimeter shape:

Even curved edges! Wow.

P.S. Later… Re-posting the same code (below) only to add the two other internalized examples of perimeter curves, shown above, and to illustrate an interesting way of working with them “live”:

div_srf_2019Jun16b.gh (17.5 KB)

I baked Crv3 (the perimeter with curvey edges) and exploded it in Rhino to seven segment curves that are imported to GH via the Crvs Rhino param and Join, before their control points are turned on to make them drag-able. So dragging control points to reshape the seven perimeter curve segments is (not quite immediately) reflected in the GH model as a new internal division pattern.


This is some legendary work that too on a weekend. Thank you very much for the definition.

Gilbert Tessellation could also be a way


Very Impressive work. Thank you.

I’m late…

Here a possible iterative solution with the good old Anemone

rectangles_V2.gh (16.5 KB)

Works only with orthogonal profile, counterclockwise orientation.

It move the shortest segment by X towards the inside the profile, where X is the shortest length of the 2 adjacent segments.
The shortest segment must be an “external” one, I’ve used some extended point inclusion test to determine this.
That’s it, looping the iteration up to the end (increase iteration count if needed).

Surprisingly neat!


Looks interesting but can’t see it in R5:


rectangles_R5.gh (17.8 KB)
You’ll need to manually add multiplication component as I can’t use the old one. It’s marked where with a group.

Just if needed, old component GH 0.9 still exists in GH1.0 !

1 Like

At first it appeared to work but now it seems broken? Sorry, any idea why? I tried but failed to understand it, especially the Extr component?

rectangles_R5_crv1.gh (25.0 KB)

I wanted to compare it to my version and noticed, in the process, that we worked on different planes (so to speak). So in my version, I replaced a XZ component with a PlFit (Plane Fit) component to fix that. I also re-oriented my examples to match yours (‘World XY’ top view) and added yours as Crv5:.

div_srf_2019Jun17a.gh (21.4 KB)

The direction of the extrusion must be inside (so, subtracting area to the main shape)
I did “found” direction by doing cross product vector from segment vector and Z vector, so yes, it have to work with only planar XY curves.
The curve then must be oriented counterclockwise (if you make a surface out of it, the normal must be equal to Z vector).
Explode and join at start was to preserve the direction during fast edits of original curve.

Maybe on Rhino5 it is working differently. Just check that every segment is oriented counterclockwise or make it so.

Edit: new version without direction problems
rectangles_V2.gh (16.5 KB)