algorithmic modeling for Rhino

Hey everybody


I've been trying to understand the self aligning process of multiple rigid geometries. In the posted file (B.08.0004) I have set up four boxes. Each corner of each box are attracting one another, the idea is that the self-alignment is controlled by the corners. 


Well, as you can see in the file, I can't make the attraction stop when each box is entering the volume of another box. Can anyone give me a hint or a way to limit the attraction in such a way that each corner does not penetrate the geometry of another object?


BR Kristoffer

Views: 5471


Replies to This Discussion

Hi Kristoffer,


Interesting definition.

In most of the self-organizing geometry examples in these videos I limited interpenetration by placing hard spheres at the centres of the objects (by interconnecting them with springs - with rest lengths and cutoffs equal to the sum of the spheres' radii).

I've attached below an altered version of your definition applying this idea(and also shown how to simplify it a bit and display the output geometry).

This method doesn't completely prevent the objects from penetrating each other, but if the vertices are snapping to each other, it's often enough to ensure the final solution is not overlapping.

It also sometimes helps to increase the exponent of the attraction force* (to -2 or -3) - this creates steeper potential energy wells, so the vertices are more likely to snap together than get caught in an in-between state. 

Also - rather than using the inspheres as shown here, you can use the circumspheres, which would prevent penetration better, but only allows the cubes to connect vertex-to-vertex, not edge-to-edge or face-to-face (This is what is shown in my tetrahedra video on the page linked to above).

I've not tried it, but perhaps by combining the 2 at different strengths (a hard insphere, and a softer circumsphere) you could get better face-to-face snapping without overlaps.


One issue with this though is that the solution will sometimes jiggle back and forth slightly because of this steepness. Reducing the timestep or switching the integration method (Solver option) to the Runge-Kutta 4th order Archimedes or Yoshida 6th order symplectic should help a bit with this.

(They should be working a bit better in this latest Kangaroo release)

Another way of tackling it is to give the attraction forces a small negative cutoff value, to avoid the sharply increasing forces which otherwise occur at short distances.




Let alone the excellent and the immediate answer I want to master Kangaroo/Grasshopper so I one day can match You when other people asks for help. This forum is such a great place. I will go through your definition methodologically. This is fantastic.

Thank You very much Daniel




Daniel is the creator of the Kangaroo plug-in.  If you can one day match his responses on this forum then you will be in excellent company indeed.  :)




Well, I think you guys will have to wait a decade or so before my simple brain can start to comprehend Daniels math and code behind the kangaroo-modules. ^_^

I will still do my best to understand everything though, because it is so damn cool.


At the moment I am trying to keep a random size box, lets say its dimensions is 0.2W x 1.2D x 4.5H from entering another random box. I am using the inner circumsphere, but as you can imagine corners may be way beyond the spheres. What I'm trying is to make a minimum number of internal spheres "filling" the box out from corner to corner. This might take some time solve :)

My aim is to be able to simulate self organisation of more complex structures, internal divisions / circumspheres might not be the best way though.


BR Kristoffer 

Thanks again.

The medial axis of a curve is the locus of the centres of the maximal inscribed circles, so you could use some of these as the collision circles (though I guess that would mean making more internal springs to hold them in place, which gets a little messy). I posted a medial axis definition on my blog a while back. This principle can be extended to 3D with a little work.


But as you say, this insphere approach is perhaps not the best one here. It depends on what you are trying to achieve.

Ive been trying to use the self aligning definition to try to put together diferent boxes (in the 3D) of diferent dimensions but they all get messed up and they not fix to the faces. Is there any way of solving this aout?

Also Ive been trying to do the same with different types of rectangles but I cant achieve anything, Im kind of desperating right now...



I am also working on self organizing boxes. My next try would have been to use collidesurf, so the corner(point)s of the boxes can't intrude each other.

As you are not mentioning collidesurf, I suppose it will not work like this.

Did you find another possibility to organise boxes by now?



Hi Marc,

I ve been trying to organize boxes similar to the posted example.

I am using centered boxes, and the powerlaw acts only on the point, but the box does not move.

I tried various methods, but still not working

Any suggestions please?


maybe you wanna post your definition?

Hi Daniel,

Thanks for this definition--I had a question about it.  I have some components from firefly adding a point every 5 seconds or so, and I was wondering if it was possible to add points during a simulation, or if you have to wait until after the simulation is over to add points?  Ideally, one could continually add points and allow this cluster to continue to grow and respond to the new information.



Hi Osma,
I was stuck at a similar problem, using kangaroo with a changing number of points. I was adviced to use hoopsnake instead of kangaroo, where you could implement force vectors aswell as the changing number, because there is (by now, as far as I know) no way to use them together.

just my two cents, greetings,


if you want to play with hoopsnake (or anemone), then you can use kangaroo zombie, they work quite well together. 






  • Add Photos
  • View All

© 2018   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service