Make 3D shape from 2D positioned objects not working?


I’m trying to do a 3D shape from 2D triangles by linking them with 0-length lines that would act as a springs that bring the triangles together. All triangle sides have been set as unchangeable by fixing their length. The idea is that I do not want to position the elements (triangles) in advance but I want to solve the linkage between them so that the most volumetric 3d shape is generated. The question I have is why does the end shape does not represent my intention and what I’m missing in the definition in order to achieve that? Maybe I should use some inflation as well? How to best add additional rules for not overlapping the triangles so that strange shapes are not generated?

Here is a the initial state with triangles and linking lines:

And here is the result of running kangaroo:

But it should ultimately look like that:

Here are the files I did the tests with:
simple triangles.3dm (180.9 KB) (20.6 KB)

Flat start: I added a load goal to make the structure stand up by itself and a plane goal to keep the tips on the XY plane. The rod goal can be replaced by a rigid point goal.

It takes some violent dragging to disentangle the structure … (34.9 KB)

@martinsiegrist yes that fix by you indeed works much better. Thanks.
For my purpose thought, I have to make the process autonomous without the manual pull to adjust the shape. I am wondering if there is a way to make the triangles not get tangled in the process of the elastic pull to assemble them together? Probably I need a custom goal what would define the relations and crossing behaviour between the triangles?

Definitely more goals, but not sure how to achieve this.

1 Like

I just wonder if this is at all possible? Anyone have seen something like that? Even though I specified which lines should be shrank the solver is messing the shape in the process by overshooting some of the positions and this creating a tangled structure I feel.

Hi @ankere

There’s not enough information in your setup to guide it.

the end shape does not represent my intention

The solver is working and correctly satisfies the length constraints you have set, but there are many possible ways to do this - this shape has many degrees of freedom - it can’t know your intention if you don’t tell it what you want.
It’s a bit like giving someone just a pile of lego parts from a kit and expecting them to build exactly the model in the picture on the box that only you can see.

You can guide it to a solution you like by using the ‘Grab’ to drag points around. When doing this it can also be helpful to slide the connection lines down to zero length, combined with the load idea @martinsiegrist suggested to pull it up. When doing this it should become clearer that the length constraints alone do not define a specific shape. (29.9 KB)

1 Like

Yes indeed, there are not enough constraints. This way of visualising it seems very cool and actually if done slowly, results are almost correct. Do you think that in order to make it work without the grab I have to create a custom goal? I think there is no existing one I can use now. I was thinking of creating a mesh out of the end result (approximate) and then inflating it. Or as the links and points give the front and back face of each triangle I have to just find a way to make them not intersect to form a good solution, right? And then adjusting the base points will change the shape into the desired volume or other parameters.

1 Like

Hello @DanielPiker

I was playing around with it a bit but it seems custom goals are not my strength. I created one called ’ Intersector’ that is trying to move the triangles if there is intersection but it seems as if its not doing anything. After that I tried one more time with a goal that is trying to find the largest distance between points.

But with it on the figure is dancing in circles as expected but I’m not sure how to best compensate for this. Do you think I’m on the right way here? I attach the newest geometry and gh files below:

triangles.3dm (163.2 KB) (32.0 KB)

Hi @ankere

A triangle-triangle collider could be quite useful, and it’s something I’ve actually been meaning to add.
It’s a relatively complex one to start with though.

The way I’d approach this would be to make tests of this intersection code not as a Kangaroo goal at first, but as a standalone script that takes a list of triangles and outputs the points where they intersect and vectors to move them apart. Only once that is working I’d turn it into an actual goal.


Thanks for the suggestion. Indeed I need to clarify for myself what’s happening with the model before I try to make a goal for it :). I’ll give it a try.

1 Like