# Kangaroo extrude until collision with other extrusions

Hi,

I’m looking for a way to achieve this with grasshopper if possible:

Input: straight lines which are connected with each other at start and end points.
Goal: Extrusion of a circle starting in the center (perp frame) of each line towards the endpoint of that line, not intersecting the other extrusions.

I think moving the start and endpoint of the extrusion could be done with kangaroo “on curve” goal but I’m struggling with the intersecting parts.

Thx in advance for thinking with me!

Which of the edges has priority and what are you going to do at the corners?

I don’t think there’s any need for iterative solving like Kangaroo here.
For a pair of connected lines, you can get the distance you need to offset cylinders by so they don’t overlap using radius over Tan of half the angle between the lines.

2 Likes

Hi Daniel,

Thx. In 2d I’ve used this solution before were 2 edges formed an angle. But in a 3d situation, I think an iterative solution would be preferable. Because 3 or more edges will affect each other. In some situations when 2 or 3 ends are calculated the fourth one has a big gap. I would like to minimize these gaps as another kangaroo goal if possible. Therefor I hoped it would be possible to calculate the best possible solution in order to minimize these gaps. The maximum extrusion is upon the end of the line or upon another extrusion. (collision).

Thx a lot!

1 Like

Hi Martin,

There aren’t any edges with priority. I want to minimize the gaps between one and another. If 3 comes together it is quite ok. But with a fourth or fifth one there will be gaps between some of the tubes. The corners will be welded later on and therefore they need to be as close as possible together.

Kind regards!

1 Like

That sounds interesting

You might want to post a simple example file …

Won’t this pose a real challenge during assembly because you will have to copy the exact positions of the rods otherwise the geometry would get changed?

Might be better to offset the ends of the rods by the same amount and weld a ball bearing at the ends?

1 Like

Here’s an attempt with Kangaroo

21_10_04_rod_length_challenge.gh (26.5 KB)

Add a Grab component and you get some sort of control on the rod order:

7 Likes

Wow Martin, Thx a lot for your interesting approach! Beside the round end it’s exactly what I meant!

Thanks