Curve division attractor point fixed lengths

Hi! Sorry for the newbie question. Is there a way to divide a curve according to an attractor point resulting in a set of fixed lengths? Imagine 10 different lengths ( 0,5 | 1,0| 1,5 etc…).

Thank you!

Can you draw a sketch of what this should look like?

Hi,
It’s something like this. Smaller and smaller the further away it gets from attractor point.

Thank you

1 Like

See attached (use it as an indicative solution unless you have plans to walk the right walk).

Curve_TrimViaAttractor_V1.gh (118.5 KB)

Hi Peter! Thank you for your help. I’m trying to figure out how can I remap the values (after divide curve from attractor point) instead of having a script ( I don’t have that knowledge).

You mean the T values? (used to trim the remaining segments [per loop] - or segment [if the start t is 0 or crv.Domain.Length: i.e. start prox pt is at ends]). If so I could very easily output these as well.

BTW: GH is acyclic by design. So for a “similar” result you’ll need something that does loops (like Anemone) but for me working with components is out of question.

Thank you for quick reply. This is my starting point. Now I need to remap the values like an incremental defined sequence (let’s say 10 different fixed lengths).
Attractor point Curve divide.gh (9.5 KB)

Wait a minute: What is the logic in your script attached? See where increment starts(*) (and compare with the C# provited that works (a) using the closest crv Pt (b) pieces lengths betweem min/maxL AND step [via div] AND push/pull mode).

(*) not in the prox - to attractor - crv pt nor in the further one.

That said: an attractor MAY “divide” a given crv in 2 pieces (according the prox pt t value) or not (see the second crv where the closest pt is at some end):

Sorry, you’re right. I figured out your script. I just wonder If this could be made without C#.
But thank you anyway!

As I said above: yes - but native components is not my game. So cross fingers for some other good Samaritan.

1 Like

Sorry for the delayed response.

What better help than Peter’s, if you’re willing to take the high road, of course.

I guess a {new} pending question is whether you care about what happens when your set amount (10) of fixed lengths (decreasing by 0.5) places points along the curve but then leaves part of the curve without points (when the total length of the curve is more than the 10 accumulated lengths) :thinking:. I used a random curve in the example. But maybe you only care about placing those 10 points not actually populating the entire curve.

So, back to native components, I couldn’t think of a more elegant way to do this at the moment other than fixing lengths with kangaroo.

In summary, and for speed, I grabbed the script you had, used your divisions to split the curve into segments, then sorted these segments based on their distance to the attractor, and specified their lengths (decreasing by 0.5):

image

Attractor point Curve divide.gh (21.9 KB)

Maybe it helps for now.

Best,
RC

1 Like

Thank you! The division of 10 was just a starting point, but you’re right. What matter is the fixed length, and you solved that.

1 Like

Good to know.

Well, like I said, ‘for now’ - especially because this works only with a linear curve. It’d go wacko with a curved one. A ‘true’ solution would involve loops, as stated by Peter. Or, some higher knowledge :sweat_smile:.

With that said, another for-now case if the input curve is a curved* curve could involve the Flow component to transfer the info from the line (guide) to the curve (target):
image

*Not bullet-proof, especially if too much curvature or bent in different directions - or too many segments LoL.

Also lastly and most importantly: the flow component is mapping the segments with the fixed lengths - this means that if you mapped the points rather than the segments, and then you were to split the non-linear (original) curve with those points, the resulting segments will not have the same exact fixed lengths as one thing is distance between points and another one is segment lengths.
Attractor point Curve divide_B.gh (20.5 KB)

Cheers