# How to use random cylinders inside a cube with geometric nodes?

I want to generate a random distribution of cylinders inside a cube using geometric nodes as shown in the related figure. The case where I used programming with pyton or matlab, I find the cylinder collision problem is a difficult problem to solve by programming. In the case of nodes used in Blender, their generation is faster, as shown on this page : enter link description here, or one of the members used a great method to generate spheres inside a cube. When changing the spheres with the cylinders in this example, I found a generation problem.

How to generate these cylinders randomly inside a cube without collision?

• Of course I forgot about the cylinder rotation, I now realize the complexity of this, not sure if I can answer, or if it's possible in blender, but i will try. Commented May 3, 2022 at 19:46
• The things we would be able to do with loops in Geometry nodes... Commented May 3, 2022 at 19:54
• This won't work 100% and the ends of the cylinders might be inaccurate, but in general I think you can generate cylinders with double thickness, then raycast along each cylinder with those double thickness geometry, and if you hit a cylinder with instance index lower than self, remove self. Commented May 3, 2022 at 21:43
• The random distribution of non-overlapping cylinders depends on the use of euler angles (or spherical angle). I think there are these angles in geometry nodes. Commented May 4, 2022 at 19:01
• Yes, there is a Vector: Rotate node, but it's not clear how this helps you. Commented May 4, 2022 at 20:02