4
$\begingroup$

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?

Circle Morph

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.

Circle Morph 2

$\endgroup$

4 Answers 4

4
$\begingroup$

I would solve this task like this:

enter image description here enter image description here

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:

enter image description here

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+)

$\endgroup$
4
  • $\begingroup$ How would you make this work for a star instead of a circle? $\endgroup$ Commented Nov 23, 2022 at 10:02
  • $\begingroup$ @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. $\endgroup$
    – quellenform
    Commented Nov 23, 2022 at 10:33
  • $\begingroup$ 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! $\endgroup$ Commented Nov 23, 2022 at 10:41
  • $\begingroup$ @LomaHarshana Thanks & You are welcome! $\endgroup$
    – quellenform
    Commented Nov 23, 2022 at 10:45
5
$\begingroup$

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:

enter image description here

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.

$\endgroup$
3
$\begingroup$

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:

circle morph

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.

$\endgroup$
3
  • $\begingroup$ Oh, sorry, I was late again and didn't see that you had already written a (very similar) reply to this. +1 $\endgroup$
    – quellenform
    Commented Nov 22, 2022 at 10:47
  • 1
    $\begingroup$ But your setup is easier... I use the Position node twice :D $\endgroup$ Commented Nov 22, 2022 at 11:03
  • 1
    $\begingroup$ 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..... $\endgroup$
    – Robin Betts
    Commented Nov 22, 2022 at 12:25
1
$\begingroup$

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

enter image description here

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Nov 22, 2022 at 8:35
  • $\begingroup$ Please see the updated problem description. $\endgroup$ Commented Nov 22, 2022 at 8:40

You must log in to answer this question.

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