6
$\begingroup$

I am trying to make a line of touching circles but cant seem to figure it out jet. What I want is just a few connected vertices, projected on the vertices are circles that touch on the outside. I think the circle radius must be the edge length minus or plus the difference of the next edge length. I couldn't translate that to nodes jet.

enter image description here

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ i am not sure whether this is possible rn with GN. It would be with animation nodes. $\endgroup$
    – Chris
    Mar 3, 2022 at 5:36
  • $\begingroup$ I guess I will need something like forloops. I could probably do it in Unreal Engine. $\endgroup$
    – Roel Deden
    Mar 3, 2022 at 10:51
  • 1
    $\begingroup$ Yep, with loops it would be possible. Animation nodes has loops ….💁🏻‍♂️ $\endgroup$
    – Chris
    Mar 3, 2022 at 10:57

1 Answer 1

7
$\begingroup$

Basically you are right, to really solve this solidly you would need more tools. Loops and more complex calculations would be nice, but are not available with Geometry Nodes alone, and this is Blender and not Houdini.

Of course you can help yourself with Animation Nodes, but I think there is a more fundamental problem here.

The following example illustrates that you can't always get the desired result using a curve as the only starting point:

Mission impossible

The distance between 0-1, 1-2 is self-explanatory, but as you can see here, it would not be possible to calculate a correct radius for another circle due to the distance between 2-3. This would be in the negative range in any case.

To solve the puzzle somehow, you would have to go the other way around and calculate your curve using randomly generated radii within a specific range.

How do we get these?

I present here two solutions:

  • Solution A: The simple variant, where a curve is calculated by randomly generated radii and directions.
  • Solution B: The complex and more mathematical or tricky variant, in which further circles are inserted between circles created with random radii and offset in position.

Solution A

  1. Here we first create a curve with the desired number of points.
  2. Once we apply the node Set Position, a radius and a direction are created per point.
  3. The calculated direction is based on a randomly created angle and a vector length that is the sum of the radii of the current and the following point.
  4. By accumulating the direction vectors created per point, the position for the individual points is obtained, which are changed there with the Set Position node.
  5. Finally, circles are created at these points with the node Ìnstance on Points and scaled with the previously created radii

enter image description here

And here is the blend file for Solution A:

Solution B

The other variant is rather more complicated and based on a tricky approach.

Even though it is more complex and less performant, it is still an interesting solution that should not work any less well.

This looks like this (roughly sketched):

  1. First, generate a curve with random positions of the points.

    Create a curve

  2. Then subdivide that curve and imagine a circle with random radius at every second point.

    This step is crucial!

    Since you don't have loops or other tools available with Geometry Nodes, you need fixed values at least every second position to calculate with instead.

    Subdivide the curve

  3. At the points in between, simply imagine more circles. The position and radius for this can be calculated relatively easily by capturing the radii and positions of the two surrounding points.

    Place circles between

  4. In the next step, however, these circles are to be shifted additionally by a random value. For this the following mathematical basis will help you:

    The math behind

    The trick is that you first take a random radius (r0) for another circle as a base, which is somewhere between the distance between your surrounding points and continue calculating with that.

    Apply the transformation

    Translated into Geometry Nodes, it looks something like this:

    The math translated into Geometry Nodes

  5. So, in the last step, if you use your randomly generated radii to calculate the positions of the circles in between, you will get this result:

    The final result

Here is an overview of the entire Node Group:

Overview of the node group

And here is the blend file for Solution B:

$\endgroup$
3
  • $\begingroup$ Wow thanks, very interesting solution. I was thinking of something similar but not creating an extra circle perpendicular to the subdivided point, that is quite brilliant. I made it work with drawn vertices instead of a generated curve, still works perfect. You put in so much work to answer my question. I really eppreciate that :) $\endgroup$
    – Roel Deden
    Mar 28, 2022 at 14:07
  • $\begingroup$ You are welcome! But be careful: The offset takes place here in the perpenticular angle, but NOT from the point which results from the subdivision. Since this point changes depending on the radius of the intervening circle, I applied the mathematical solution as described above. $\endgroup$
    – quellenform
    Mar 28, 2022 at 14:39
  • 1
    $\begingroup$ Clever and well written. Nice one ! $\endgroup$
    – Gorgious
    Mar 28, 2022 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .