Armin Hofmann Tangents

Hello :slight_smile:

I’m wondering whether it would be possible to create a similiar Effect to the Armin Hofmann Shapes in TouchDesigner.

I found this JS code but was wondering if there is a way to implement it with Nodes.

Any Input would be appreciated :slight_smile:

The .js code gives you generalized lines (think y = mx + b) that will be tangent to the two spheres, but that’s not really what you want. I got a decent result with ChatGPT using the prompt

I need the python function that gives me the tangent line segment joining two circles

or so I thought, until I actually plugged it in. I’ll try to find the “correct” result…

Anyway, once you have that working with a Script SOP that takes in a pair of circles and spits out the four tangent lines, you can make a Table DAT that contains all the info for each circle (x, y, rad) and a column for which of the four tangents to take you to the next circle, than use a Copy SOP with stamping to get each circle pair and its tangent lines.

You’ll need to invent a way to say that a particular sphere is positive (black) or negative (white/clear), and use pairs of lines in the DAT to determine if you need inner or outer tangents, and which ones. That’ll take some work especially if your circles float around across the frame range and a circle that was negative turns positive for some reason.

After several AI’s gave me just-not-quite-right answers, I went and just worked my way through their code to get it to behave correctly.

circletangents.tox (3.5 KB)

However, there might be a simpler approach if all the circles are the same size. Then the scenario is a bit more like this:

So with this not too crazy network of SOPs


I can get this

I started with a grid, picked the order of the circles, then each circle is deemed as a “right turn” or “left turn”. I used copy stamping to isolate each pair of circles, run the Script SOP on it to generate the four tangents and then pick which of those four to use based on the left-turn/right-turn of the two circles.

1 Like

Wow, your result looks amazing! Will try to recreate your approach tomorrow!

I’m new to TouchDesigner and was just wondering whether it would be possible to do this in this program since I can’t quite comprehend it’s possibilities (and limitations) but that looks perfect.
Is it possible to animate the circles and have the ‘rubberband-shape’ react to that with your approach?

Yes, the tangents properly react to changes in size and position as the inputs to the function is from the Script SOP’s parameters, and those parameters are fed by functions that look at the input circle’s position and radii. I have a video but the forum wouldn’t allow me to upload it. Also, my current solution is just the tangents between the circles, i.e. no arcs from the circles. Ergo, I can’t make a closed polygon (yet).

1 Like