# Fitting mesh into shape

Hi there,
I’m trying to force my coarse mesh into a simple shape (define by a rectangle and a circle).
Goals that I used:

• “Anchor” to put 4 mesh corners to rectangle corners.
• “On Curve” to force mesh boundary into the input rectangle and circle
But the result failed at some points:
• one of 4 corners points not pinned to located.
• “On Curve” works well but the result has some mesh faces folded through others.

How to get a better result? Any insight would be greatly appreciated.
Thanks.

Rebuild Mesh.gh (18.5 KB)

fitgrid.gh (20.0 KB)

You can sort by distance to make sure the naked verts pull to the correct segments of the target boundary, and the corner verts to the correct corners.
To stop the faces folding over themselves, you can use the PolygonArea goal with a target area of 0.

4 Likes

First thing to fix is the T input on the Anchor goal.

In your definition, you had the 5 vertices of a curve as target points. That doesn’t work since you have 4 mesh corners. You can find the closest points from all 4 mesh corners like this:

No reason to continue when Daniel Piker replied

2 Likes

Thank you Daniel. I’m learning something new on Kangaroo everyday!

1 Like

I should also mention - although it is possible to prevent the foldovers with the PolygonArea goal like I showed above, the fact that they were happening in the first place often suggests the mesh topology being used is not the best fit for the shape. Here if you just add a few extra horizontal divisions either side of the hole (using InsertEdge) then it works even without PolygonArea, and gives more rectangular faces:

Yeap, putting a good solution of mesh layout is the hard part. Can you please suggest any resources for a better understanding of mesh topology?
PolygonArea is a new goal for me, and here is the result when I apply one more Solve w/ Polygon Area.
P/S: Where I can find “InsertEdge”? Is it a Rhino command or a GH component?

InsertEdge is a Rhino command (in the WIP version)

You could also try the QuadRemesh command:

4 Likes