0
$\begingroup$

I'm working on a Geometry Nodes setup and need help calculating the Factor for the Sample Curve node.

The goal is to distribute points along multiple curves such that the longest curve gets the specified point count, and the shorter curves distribute points proportionally based on the same segment length as the longest curve.

I’ve managed to calculate the point count for each curve using the following steps:

  1. Find the length of the longest curve using the Attribute Statistic node.
  2. Divide the longest curve length by the desired point count to get the base segment length.
  3. Divide each curve’s length by the base segment length and use Ceil to get the point count for each curve.enter image description here

Now, I need to calculate the Factor for the Sample Curve node to distribute these points correctly along each curve. How can I calculate this factor so that it ranges from 0 to 1 for each curve based on its length and point count?

enter image description here

I would also like to be able to "preview" how it would look like while the instances, scroll/move/flow along each spline. Here is a gif from my original geometry nodes setup which only work on 1 spline, which have turned into a nightmare to work on at this point 😅😂 enter image description here

$\endgroup$

1 Answer 1

0
$\begingroup$

If you calculate your own length from the desired count on your longest spline, you can leave the rest to Curve to Points (By Length):

enter image description here

Owing to the requirement that the endpoints of splines should always be represented by Curve to Points, there will be a sampling error, more noticeable at smaller counts. You could avoid this by trimming the lengths of splines to exact multiples of the longest spline's segment-length:

enter image description here

If that's a concern, given a trimming policy, (from the start, end, or centred) we could fix it.

$\endgroup$
8
  • $\begingroup$ Thanks, yea that was a smart way to do it actually. But will it be possible to animate this as well? So the instances will like "scroll/move" along the splines? $\endgroup$
    – Kristian
    Commented May 27 at 10:29
  • $\begingroup$ Thanks, @Kristian :) Since the number is always an integer, we have to know how you want the points to flow.. eg from one end, with a varying gap at the other? $\endgroup$
    – Robin Betts
    Commented May 27 at 11:37
  • 1
    $\begingroup$ I updated the main post now with a gif of how it should look :-D $\endgroup$
    – Kristian
    Commented May 27 at 14:17
  • $\begingroup$ .. but what you show there is a continuous change! If there is always a whole number of divisions of the longest spline, it would jump! .. I'll do a continuous version, just by length $\endgroup$
    – Robin Betts
    Commented May 27 at 14:40
  • 1
    $\begingroup$ hmm, thats a bit unfortunate $\endgroup$
    – Kristian
    Commented May 27 at 18:16

You must log in to answer this question.

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