1
$\begingroup$

I have a zigzag bezier. I want to connect every nth with every nth+2 vertex (with a curve).

It is possible to use indexpositions as start and endpoints for a curve line node, however that only creates 1 curve when I want n curves instead. The curve line node cant have multiple inputs to create more curves, so generalizing the input with the "index+modulo" nodecombo doesnt work.

How can i get n curves?

enter image description here

Markus von Broady suggested a solution that works almost perfectly. Just need to figure out how to remove some of the instanced lines now without the remaining ones randomly jumping all over the zigzagcurve

enter image description here

$\endgroup$
2
  • $\begingroup$ There is a solution and it's easy, but please clarify: why do you want multiple, rather than just two curves? As you cna have one curves going on the left of the zigzag, and another on the right. One curve would go through all left points, another through all right points. One reason why you would want separate curves (more than mentioned two) is if you e.g. wanted to convert them to mesh, and wanted them to be separate segments rather than continuous… $\endgroup$ Commented Oct 9, 2023 at 18:18
  • $\begingroup$ the reason i want multiple small curves in those locations is because the zigzag line is a super simplified representation of the "bendy river" you helped me with the other day and im trying to figure out how to add parts where the river splits in 2 and then merges again . $\endgroup$
    – sinwar
    Commented Oct 9, 2023 at 19:06

1 Answer 1

2
$\begingroup$

Consider this setup:

It first converts a spiral to a zig-zag, then spawns curve lines on all points but the last two (notice how the End position socket of the Curve Line is hidden, because it's irrelevant - about to be set) , then the instances are realized, for each end (as opposed to start; the 2nd point) is moved: first the index of this point is divided by $2$ to calculate the index of the point spawning this curve (alternatively the instance index could be captured before realizing it), it's not floored, because for the end of a curve it's always divisible by $2$, and once the index of the spawning point is known, add $2$ to it (on zig-zag every odd point is on the left, and every even point on the right, or vice-versa; so $+2$ means next point on the same side). This is basically it, the rest is using some logic to do something fancy with the curves…

That's 78 separate curves:

But the same effect could be achieved with just 3:

Or even just 1!

$\endgroup$
4
  • $\begingroup$ The method with dividing the index by 2 works so far. But i also tried to capture attribute the instance indices and it doesnt work at all. it appearently just returns a zero instead of "integer field based on index" like the divide method does. $\endgroup$
    – sinwar
    Commented Oct 10, 2023 at 16:35
  • 1
    $\begingroup$ @sinwar i.imgur.com/lyYJHkl.png $\endgroup$ Commented Oct 10, 2023 at 17:06
  • $\begingroup$ i did use exactly that capture method and it didnt work! it returns a 0 and then a 2 gets added so all the curves have their endpoints moved to index #2: imgur.com/a/xoN4lSU And the "divide index method" just works for some reason: imgur.com/a/cPSQldp $\endgroup$
    – sinwar
    Commented Oct 11, 2023 at 14:40
  • $\begingroup$ NVM i found the mistake. the realize instance node gets the wrong instance feed $\endgroup$
    – sinwar
    Commented Oct 11, 2023 at 14:43

You must log in to answer this question.

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