Laplacian Smoothing in Kangaroo 2


(Paul Muell) #1

Hey guys,

I am trying to planarize some hexagons on a double curved surface. It works very well by far. But at some point my surface gets an “edge” where the curvature changes its algebraic sign. My idea was to do a laplacian smoothing goal object, like the force object from kangaroo 1. Isnt there an laplacian smoothing in K2 anymore? How can I smooth out the edge?

Best regards

(Daniel Piker) #2

The ‘Smooth’ goal is the equivalent in Kangaroo2 (the smoothing used is still the same Laplacian smoothing).

I made it so it just takes a mesh as input, to avoid users needing the extra components to identify sets of vertices and neighbours. I hadn’t thought about this case though were you don’t have a mesh (or it is made up of ngons).
Internally though the goal still works the same, so with a small script it should be possible. I’ll post an example of this in a minute.
Can you post your file?

(Daniel Piker) #3 (18.5 KB)

Here’s an example of smoothing and planarization of hexagonal panels

Because of the scripted component you’ll get a message about the referenced assembly location the first time you open it - you’ll need to set this to the location of the KangarooSolver.dll that Rhino is loading.

If you are using Rhino6 this will be something like
C:\Program Files\Rhino 6\Plug-ins\Grasshopper\Components

or if you are using 5 it will be


Nice, did not know that is possible to do so. Would it be possible to wrap these lines into a component too at food4rhino?

Hmm I tried the same thing several times. The laplacian smoothing does not give an effect if CoPlanar goal is set to 0 as strength. I think it should help a little bit not to distort panels too much but I do not see big effect just for smoothing. Cull pattern for sure distorts the planarization.

I have one question why there is cull pattern ?

(Daniel Piker) #5

Hi Petras,

Yes, I should be able to include some version of this as a standard component in the next release.
Eventually of course it would be nice if it could take ngon meshes directly.

I forgot to mention for anyone else that downloads that file above - it uses the old ‘topologizer’ component (which you can find here) to get the mesh vertex neighbours.
I used the cull pattern to get only the vertices which have 3 neighbours - to avoid affecting the points of the hexagons on the boundary, as otherwise I think it would straighten these out and shrink the whole shape.
It looks like you’re using your own way of getting the vertices and neighbours though.

So I’m not sure I completely follow your post - is the bottom right image what happens with no Laplacian smoothing?

I think in general Laplacian smoothing will only work for keeping planar hex meshes smooth when they have positive Gaussian curvature. Once you have negative curvature and the hexagons become convex, the ideal location for a vertex may be outside the triangle formed by its neighbours.
Another approach to smoothing hex meshes I’ve played around with is making pairs of opposite edges of the hexagons parallel, since this can be applied to both convex and concave hexagons. I didn’t take this far enough to get nice results from it - but maybe it is possible…


Oh, I was using different adjacency, after looking at “topologizer” I extracted correct mesh ngon vertices for laplace smoothing.

And I see that on positive curvature it is good to use those two goals (smooth + project points on plane) but on the negative curvature it is better to project points on plane only without smoothing. I think you meant the same thing?

(Daniel Piker) #7

Yes exactly - this smoothing+planarization works okay for positive curvature, but for negative curvature I think some different strategy would be needed to keep the hexagons ‘nice’.

(Paul Muell) #8

Hey Daniel,

thank you for the quick response and in the same moment I am sorry for mine being late. So I dragged the old topologizer on my grasshopper canvas and I renewed the path for the .dll. But the laplacian component has another error. Idk if anyone of you could help, because its in German.

“1. Error (CS1705): Die Assembly ‘KangarooSolver, Version=, Culture=neutral, PublicKeyToken=null’ verwendet ‘RhinoCommon, Version=5.1.30000.13, Culture=neutral, PublicKeyToken=552281e97c755530’ mit einer höheren Versionsnummer als die Assembly ‘RhinoCommon, Version=5.1.30000.12, Culture=neutral, PublicKeyToken=552281e97c755530’, auf die verwiesen wird.”

Can’t update my Rhino to a newer version. Does anyone know what to do?

How do I make my file ready to post? I read about that it needs to be prepared somehow, so that it isn’t to (49.3 KB)

(Daniel Piker) #9

It looks like you just need to update your Rhino to a more recent service release