I am working on a organic look pattern. I was able to create a 3d shortest walk pattern on a mesh (this is just a little piece of it cut by a box). I could join and extrude a geometry to be be able 3d print it. It is on the right side of the image.
shortest walk pattern.3dm
I would prefer a more organic look by adding a bit of curvature to the polylines. The problem is when I change the curve degree to 2 on the nurbs widget, the segments go away from each other. It is possible to have the original network look with nurbs curves?
shortest walk pattern.gh (28.9 KB)
I see that the solution is generated with C # script. Is it available somewhere? Sorry I could not find it.
Here’s a little script for smoothing a graph:
graphsmooth_example.gh (48.9 KB)
and with the initial graph generation using shortest walk:
graphsmooth.gh (12.8 KB)
I guess it could be adjusted to also merge the segments into nurbs curves.
Thanks Daniel it is a good thing there is a Mc Neel tool for that.
Thank you Daniel! It is great. I have to offset the curve in both sides to be able to make printable stuff. However I have noticed that those area where curves are connected are built from invalid curves. It is strange because when I explode them they become simple lines. Why are they invalid?
Ah, I just noticed that there I output the curves in both directions, so each segment is duplicated, which would cause issues when you try and join them.
Anyway, I think it would be better to do the joining inside the script using the graph. I’ll add something for that.
Here with joining the segments into nurbs curves in the script so they can be offset.
your smoothing tool is very good and not exactly the same as mine as I subdivide Curve like Catmull&Clark algorithm. So it is possible to have 2 flavors of smoothing, yours in white and mine in red.
Mine follows the geometry obtained using Fatten followed by Catmull & Clark Subdivision
So I think it could be a nice addition to Grasshopper if you could add one or two smoothing component in Kangaroo or Curve Tab.
For the offset, you could use Clipper and Polyline Offset to do the whole offset.
Ah, got it thanks. Yes - mine is essentially laplacian smoothing of the graph vertices, so a different sort of smoothing to the one you get from subdivision. I think both types could have their uses. An interpolating subdivision type might be another nice one - so the curves get smoothed but still pass through all the original points.
Yes, I can add some graph smoothing components.
I think some more general graph components could be good to have in G2. There’s already some better built in tools there for querying adjacencies of meshes, but I find it’s often helpful to also be able to access this sort of data for sets of edges that don’t neccessarily form closed loops around faces.
I hadn’t realised Clipper could do offsets on this sort of curve network too - good to know.
Awesome! Thanks Daniel! You made my day again!
One more little note on this - if you just want to smoothly interpolate the graph, so it goes through the original points, you can use the joining part with the smoothing iterations set to zero:
interpolate_graph.gh (8.6 KB)
Thanks for recommending this thread, @DanielPiker.
Here’s how your example looks with cubic subdivision (2 levels), instead of interpolation.
How does this work behind the scenes? Something like Verlet integration with anchors and springs?
That animation above is from the same script I posted further up, just increasing/decreasing the number of smoothing steps with a sine function. So here there are no springs/momentum etc, just iteratively moving each graph node to the average of its neighbours positions.
Of course physics was where I was going with this.
There’s a version of this half-edge graph structure as part of multipipe, but one of the things I was playing with it for is relaxation with topology changes - eg. finding Steiner trees: