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.
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.
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.
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 )
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â:
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.
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).
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:.
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)