Snapping a Square grid to an outline

Dear Grasshopper Community,

I would love to know if there is a way in Kangaroo or any other plug in or ways to snap a grid of squares to a planar none formal outline with different number of edges. I would like to also rearrange the shapes to be closed planar poly-lines. I thought of making it into a mesh through Weaver bird with quad division and re-extract the lines or vertices but I didn’t have much luck with that.

Here is a screen shot if what I want to achieve and the Grasshopper/Rhino file.

Fitting Squares to an outline.3dm (28.1 KB)
Fitting Squares to an outline.gh (13.9 KB)

You can pull points to a curve, or pull selected points to the corners of your outline.
Do you want to let all the squares distort?
If you want to snap all around the outline, obviously you’ll end up with some triangles too.

try to split the surface by the grid

1 Like

Hey Daniel,

Thank you for responding. I would not mind at all for the squares to distort. Any help in doing that ? I would really appreciate it !

This is fantastic but I am also interested to explore the option of making the squares get distorted which is more of what I was looking for ! but thank you so much for the help !

Bump ! Anyone can still help me with the squares grid being deformed to snap to the outlines and be re-arranged to be closed through simple planar surfaces ?


gridmorph.gh (9.5 KB)

Here’s a tool I made a while ago for morphing geometry with polygons using something called Mean Value Coordinates, which is a sort of generalised barycentric mapping.

On the left is some sample input geometry - a grid, and a polygon which does not match the grid edges or vertices.
In the middle is some chosen reference polygon which approximates the input curve, but does match nodes of the grid.
On the right is the output - the grid morphed to the target curve.
When drawing your reference and target curves, you need to match the vertex ordering - for example start both in the top left and go around clockwise.

You could use this as a starting point for further relaxation with Kangaroo if you wanted for example to try and make the grid straighter, or more even.
You could also go straight into Kangaroo and pull points to the curves and corners, but I think this can be an easier way to start.

1 Like

Bear in mind that how the reference polygon nodes with the grid is critical, and many choices are possible here, depending on the type of distortion you want.
For example, here’s a different reference with the same target and grid as above, but this time keeping the bottom 2 edges in a line:

1 Like

This component can also morph all sorts of geometry, including meshes with colours, so I think all sorts of applications are possible…
imagemorph

7 Likes

Thank you Daniel ! I will definitely give it a shot !

Hey Daniel,

Can you kindly give me simple steps to how to run it as I sadly don’t have any experience into C# codes in Grasshopper? or maybe if u can upload the rhino file as well so I can understand how it works !

Thanks,

You don’t need to know anything about C# to use this, as it has no references and you don’t need to change the code - just treat it like any other component.

I see I forgot to internalise one of the curves though. Here it is with all the inputs internalised:
gridmorph2.gh (9.6 KB)

You just need to replace the inputs with your grid and curves