# Geometry Node: Cyclic Curve Morphing

I am trying to morph a straight line to a circle. But the last edge of the circle is not included in the morphed output. How to fix this problem?

Edit: I gave the example of the line because it's the simplest one. But I want this to work for other open ended curves also like a Bezier Segment.

I would solve this task like this:

In a circle created with Geometry Nodes, there are no duplicate points, so the actual start point is not at the same position as the end point.

Instead, these are connected by declaring the curve as Cyclic.

In your example, however, the end point should be the same as the start point.

Therefore, you can simply create a circle that has one point less than your line, and using the math node Wrap you can use it to map the last queried point to the first when transferring the positions.

Update

Of course, you can also use other shapes with the same technique, such as a star:

The important thing is always: The number of points of your line is always one point larger than the number of points of the closed shape!

(Blender 3.2+)

• How would you make this work for a star instead of a circle? Nov 23, 2022 at 10:02
• @LomaHarshana With a star, of course, this also works, but you would have to consider the number of points, since a star is created via other parameters. See update. Nov 23, 2022 at 10:33
• Yours is a very beautiful solution, it's so simple and caters to the generic conditions (open and cyclic curves of any type) and also makes use of mix node, which is a very natural representation of morphing. Thank you! Nov 23, 2022 at 10:41
• @LomaHarshana Thanks & You are welcome! Nov 23, 2022 at 10:45

A circle in Blender is a Spline set to Cyclic by default, so the position of its last vertex does not quite reach its first (if it did, there would be a doubling there), which is what you need in your setup. Easiest way to get a circle that has double vertices at the first/last point would be to use a flattened (zero height), single-rotation Spiral instead, with one less "resolution" from your main resample count:

Note: I'm using Blender 3.5. With 3.4 onwards, Transfer Attribute node has been replaced with three new "Sample" nodes, that's what you're seeing in the visuals.

Since you don't want a cyclic spline, your problem is that you cannot use the same number of segments for the line and the circle - because then you're missing the segment that connects the last with the first point.

Instead you need one more segment for the line and the first and last point need to be in the same place. To do this, there might be a better setup than mine, but it works:

I have an Integer input which controls the number of segments, I add 1 for the line so that you have a segment to connect with the starting point.

The position of the curve points go into a Transfer Attribute node with the index converted by a Math node set to Modulo with the number of segments. This makes it look cyclic in the end.

To change the position of the line points, they are offset by the difference between their original position and the position of the circle points. The Vector Math node set to Scale now morphs from line to circle if you change the value from 0 to 1.

• Oh, sorry, I was late again and didn't see that you had already written a (very similar) reply to this. +1 Nov 22, 2022 at 10:47
• But your setup is easier... I use the Position node twice :D Nov 22, 2022 at 11:03
• I've gone down a similar route to yours and @quellenform 's, but using a complete duplicate of the curve and its handle positions, for splitting an arbitrary cyclic spline. I'm getting stuck atm trying to split only the cyclic splines in a multi-spline curve. May post a q of my own..... Nov 22, 2022 at 12:25

one way would be, to use "set spline cyclic":

• This adds an extra segment to the line. Instead of line if I have another open ended curve (like a Bezier Segment) this would change the nature and appearance of that curve by making it closed. Nov 22, 2022 at 8:35
• Please see the updated problem description. Nov 22, 2022 at 8:40