# Grid pinching into curve alignment

Hello,

In short, I am trying to pinch a grid into alignment to curves derived from certain site conditions (these will differ based on location but waterways, topographic features, major roads etc are typical examples…).

To be clearer here is one example of a desired outcome.

The result I am after should produce a grid that maintains a predefined number of cells in the XY direction and roughly stay within a predefined cell proportion.

The reparametrization component in Millipede can produce quite a robust network as you see below

The nice thing here is that you can also add a rotation to the system so it can align to your input at a set degree. (at 45 degrees here for example)

Though with this approach it is difficult to dictate the number of cells produced or have a clear XY direction. So, I had to look for another solution, and this perhaps is my most successful attempt so far.

Its based on tracing a streamline through a vector field generated by 3 curves (derived from waterways), I have repurposed a surface principle curvature c# component to do this based on RK4 method (originally written by David Rutten with contributions from Sam Gregson and Tom Jankowski) - instead of tracing through max / min curvature on a surface, I am tracing parallel or perpendicular to a field. I believe the millipede component is working in a similar way, but perhaps it is using eigen fields instead.

My method, of course, can lead to undesirable results with streamlines converging especially in the perpendicular direction or if I add any rotation to the original field (which is something I would also like to do). I feel like my approach is overcomplicating a seemingly simple problem and there is a much more straightforward way of doing this. Any advice on how to push this into a more refined outcome would be highly appreciated, likewise, any advice on taking a whole different direction will be received with equal appreciation

I hope the attached files aren’t too complicated, but I have commented the process out more clearly - its mainly 4 steps.

Many thanks,
Aziz

GridPinching.gh (189.4 KB)
GridPinching.3dm (108.4 KB)

1 Like

I feel like you could accomplish this by “tweening” the curves. @Michael_Pryor put a great plugin for that Pufferfish