Kangaroo2 on Rhino6 / ImageCircles

Hi all,

A two-part question:
First, is Kangaroo2 working on Grasshopper in Rhino6 (probably a dumb and ill-informed question…)?
And secondly, if so, I am wondering if the ImageCircles component is working correctly.
It seems to be returning an array of double instead of circles like how it should be and how it has worked before in Grasshopper for Rhino5.

Please find attached an example script.
ImgCir_011518.gh (42.8 KB)

Thanks a lot,

Tim

Hi Tim,

The ImageCircles component has only ever returned doubles - these are the radii of the circles.
Here’s an example file showing how this output can be used together with the point locations as centres to draw the circles:
https://github.com/Dan-Piker/Kangaroo-examples/blob/master/collisions_and_packing/Image_circlepacking.gh

One thing that has changed in fairly recent versions is that the main Kangaroo Solver component can now have a tree structure for the output (with the same structure as the goal input). The old non-tree version is still in there as a legacy component (it isn’t available on the toolbar, but it will still show up in older definitions using it. You can tell the difference by hovering over the ‘O’ output, and seeing whether it says ‘as list’ or ‘as tree’). It looks like your definition includes this pre-tree version. Replacing it with the one from the toolbar removes the need for these casting scripts.

…and one final thing - it looks like this component behaves oddly when the input mesh is not triangulated. I hadn’t noticed this before. I’ll fix that for the next release, but for now, please triangulate any meshes before using them with this.

Here’s a fixed version of your definition:
ImgCir_011518_dp.gh (38.5 KB)

Hope this helps

Daniel

Hi Daniel,

Thanks so much for the informative and helpful response. I somehow realized those were the diameters but didn’t realize the point locations were in the output V… The tree structure is great! The casting has always been a pain.

Not sure if this is relevant at this point, but please find attached an old scripted adapted from one of your earlier ImageCircle component - the solver in output O is actually an array of Circles.
ImgCir_OLD_011618.gh (67.6 KB)

In addition, I have another subsequent question:
I was actually using this process as a way to dither points according to an image by extracting the circle centers, but it seems to be an expensive way to do so. I was wondering if there are other adaptive sampling methods implemented before in Grasshopper already?

Thanks again,

Tim

A long time ago I did some image dithering using Lloyds algorithm:


but I don’t think it was very fast. You could probably do the same thing faster in a simple script.

I have also experimented with using remeshing for image based dithering/stippling (using local image brightness as the target edge length). This is similar to using Lloyds algorithm, but avoids having to recalculate the Voronoi diagram each iteration, as the connectivity is updated locally, so it should be faster.
The version on here has an example of this:

I warn that it’s not polished though - and getting all the right versions of the libraries referenced can be a bit of a headache.
I have also been trying recently to reorganise/rewrite some of this remeshing code.
I saw this nice work recently and might have a go at incorporating some ideas from it:
http://vcc.szu.edu.cn/2017/WeightedLBG/

There are also some nice ordered dithering algorithms, such as using a Bayer matrix that gives a more old-school look. http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code/

1 Like

Hi Daniel, Thanks a lot for all the infos and resources - will look into them.