# Converting an old python generated model into a geometry nodes tree (fun exercise)

With the following input geometry:

And some additional python, I created this weird thing:

The basic idea behind the structure is to start with a vertical wave or a curve piece (aka ‘fingers’) that can be stacked seamlessly or looped:

Then iteratively rotate around the z-axis 66 times, generating an offset piece by a constant along the z-axis (in this case 1/22 which results in a 3 sided structure).

At a glance it looks like the individual fingers are bending (not flat) but from the top-down you can see they’re straight

This should be easy enough to do in geometry nodes by myself, until I tried to figure out how to create the 2 ‘ring pieces’ (that’s what we’re calling them) that holds the body together.

In the original python script I used a load of ray casts from the centre of the ring piece towards the inner facing edges of each finger, to form a low poly curve (66 points).
I up-sample the curve to round it off and negatively/positively offset the curve to form 2 loops that get stitched together to form the basic shape of the ring piece, which in this case resembles a triangle.
Along the way we also cut some interlocking notches so there is no overlap between any of the pieces, but let’s ignore that for now.

There must be a much simpler method to generate the ring pieces with some clever maths in geometry nodes.

I’ve come to the conclusion that ring pieces are just distorted circles.
But how do I distort my ring piece to perfectly align with my fingers at any depth inside the body?

The ray cast method worked, but it created some noticeable imperfections that wouldn’t have occurred if I’d used a purer approach.

I look forward to your responses.

Maybe… if you provide some more info where you got this idea from and/or possible some math formulas… ??
Right now i can only imagine… some wave somehow rotated

I’m not a maths guy, sorry.
The process I used to generate the original model it was simple, just shooting rays from the centre to each finger at a defined height to find an approximate point on the ring, but presumably there’s a way to… distort (?) a circle curve using the finger curve / wave with some clever maths that would generate the perfect ring piece (geometry).

My original method was a terribly inefficient way of doing it, I’m now just looking for the ‘perfect’ way that can also be replicated with geometry nodes.

If I can figure this out I would also like to see if it’s possible to invert the process, whereby I define a ring curve and generate fingers.

I’m slowly (very slowly) start to imagine how this might work… possibly… maybe…

This was a fun exercise, thanks.

Spin phase profile.blend (126.1 KB)
(Saved in Alpha 4.3)

4 Likes

…i was slowly… slowly trying this…

…and now i have to get a break and then study yours a bit (not using 4.xy yet…)…

1 Like

Added a Phase Cycles input… This is probably a requirement.
Spin phase profile1.blend (121.9 KB)

6 Likes

Wow, I learn by example and this is a fantastic example.
I’m going to be studying this.
Thank you!

This node tree is amazing and provides a great basis, but there’s 1 issue I’m trying to tackle.
If I increase the number of ribs the rings become more defined. I want to use a lesser number of ribs but maintain that ring definition.
The definition of the ring is currently dependent on the number of ribs, using the raycast method to generate new positions.
I could smooth out the resulting ring curve but it would not be perfect, there are not enough points that becomes evident with some shapes.
The raycast method works great for generating each rib phase (very clever!) but I think the ring could be defined in a better way.

I’m still thinking it should be possible to distort a circle using the rib curve.
If we use a phase cycle of 3, we create 3 ribs, join them side by side to make 1 continuous curve, then we sort of bend it 360 degrees into a closed circle.
I’m pretty sure that would result in the same shape, and it would allow for the ring resolution to be independent from the number of ribs.
I just don’t know how to bend a curve like that in geometry nodes though.

I’ve done a few tweaks to zeroskillz’ work…
I’ve made made the actual total # of ribs = phase cycles * number of ribs, to force each ‘side’ to be symmetrical.
I’ve separated the ring generator into its own node tree so I can have unlimited number of rings (just add another modifier to the stack)
And I’ve simplified it to generate a load of curve instances but nothing solid, which helps with testing accuracy.
I’ve done various other tweaks but those are the main ones.

spin test.blend (421.8 KB)

Never mind - I figured it out!