# Is it possible to dynamically collapse all edge rings or scale a tube thickness to zero using Geometry Nodes? [duplicate]

Is it possible to dynamically collapse all edge rings or scale a tube thickness down to zero using Geometry Nodes so that i'm left with a curve originating from the center of the original object? Let's assume you only had the final mesh available with no radius or other data.

• Robin? where are you? r u already working on a solution? or still sleeping? i know you can do that...! don't be shy here! :D Commented Apr 6, 2022 at 9:00

If you know the logic behind the topology of the curve, you can figure out the relations between vertices simply by their indices. In case of curve beveling, each vertex spawns a circle, and circles assign indices one circle after another. Here's how it looks like with animated Build Modifier (which reveals vertices starting from the lowest index, and ending on the highest index):

So if you create your mesh differently with different indexing, you will need a different algorithm. Here's what I came up with:

1. Get the distance between vertices 0 and 1, which is the length of an edge on the first ring.
2. Get the distance between vertices 0 and 2.
3. If you assign (in your mind) letters to those 3 first vertices, in order, you can now imagine an isosceles triangle $$\triangle ABC$$, with equal edges=arms $$\overline{AB}$$ and $$\overline{BC}$$, measured in p. 1., and base $$\overline{AC}$$ measured in p. 2.
4. I found a formula to calculate angles for a triangle using edge lengths: Triangle Calculator, and simplified it using WolframAlpha.
5. Once you have an inner angle, subtract it from 180° to get the turn angle. Divide 360° by it to get the number of turns, and therefore the number of vertices in a circle.
6. Now you can use modulo to get the circle number, or the "local" circle index - only the latter is needed in this case. By "local" I mean the index a vertex would have, if you removed all other circles.
7. From there all you basically have to do is to move the first vertex of each circle halfway towards the middle (index-wise) vertex of that circle.
8. To be super accurate, I take care of bevels with an odd number of vertices in a circle. So I floor/ceil the index increased by half of a circle, to get two indices on the opposite side - for even circles, that will be the same index twice. Then I multiply current position by 2 to have an equal weight to those 2 vertices on the opposite side, add it all together and divide by 4 (which I think is simpler than doing a vector subtraction for an offset, and dividing the offset by 2).

Here's the beveled curve, and z-fighting of the restored curve together with the original curve duplicated before beveling:

• very nice one....!+1 Commented Apr 6, 2022 at 18:50
• +1 You are right, there are similarities ;-) blender.stackexchange.com/questions/250675/… Commented Apr 6, 2022 at 20:56
• very nice approach man, thank you for sharing your ideas and thoughts i really appreciate the time, effort and big time help! Commented Apr 7, 2022 at 1:21
• @quellenform one more thing, this deals with an odd number of vertices, though the number of vertices is resolution * 2 + 2, so it's always even without using a 5 vert circle converted to a curve. Commented Apr 7, 2022 at 6:57

I would do it like this:

1. Select one edge ring with Alt+LMB and then from the menu Select > Select Loops > Edge Rings.

1. Now that all edge rings are selected, make sure you've set Pivot Point > Individual Origins.

1. Now hit S > 0 > Return to scale all rings down to zero.

1. If Auto Merge is enabled, all vertices in the same location are merged into one and you have a single edge. Without Auto Merge, hit M > Merge > By Distance.

• he asked...using geometry nodes... ;) Commented Apr 6, 2022 at 8:45
• @Chris Haha, ich Trottel. :D Yeah, my mistake. In Geometry Nodes I'm just wondering: there should be the original curve somewhere which created this tube... why not use it as "scaled down" version? Commented Apr 6, 2022 at 8:45
• das hab ich schon 1000x geschafft ;) ich lese einfach zu schlampig :D Commented Apr 6, 2022 at 8:48
• hahaha kein ding man. es ist irgendwo dynamich erzeugt. ich glaube es ist nicht moeglich mit geometry nodes Commented Apr 6, 2022 at 8:51
• ich glaube schon, daß es möglich ist....aber das wäre echt ziemlich komplizierte Mathematik...und meine Mathekenntnisse reiche dafür nicht, fürchte ich...aber Robin Betts würde ich es zutrauen.... Commented Apr 6, 2022 at 8:54

For starters, I propose this:

It flips vertex normals and raycasts along them to see how far is the opposite side, then moves the vertex along that normal half of that distance. It's not perfect, but gets the job done with welding afterwards.

Except some rays will miss the other side completely:

How the rays look:

You could use an attribute statistic node to gather the average position of all vertices that missed the raycast (hidden output of the raycast node on the screenshot), and move those vertices there, but unfortunately you're not guaranteed that only a single ring will fail (rings on both sides of the curve could fail, also multiple rings could fail for dense topology).

I'll have to come up with something else... 🤔

• that's an interesting workaround approach, thanks for sharing your idea! Commented Apr 6, 2022 at 12:56
• wow.............+1 Commented Apr 6, 2022 at 13:06