# Round the curves in length, keeping the same start and end point

Hi all.
I’m trying to change the shape of these curves to set their length rounded on a predefined pitch:1 cm (units are in meters)
The difficult part is the starting point and the end point of each curve should not change.
What sort of approach might be used?
Im testing kangaroo 2, i think its the good tools but for the moment I still cant find the solution.
Thanks a lots

You want to change the shape of those curves - why don’t you use the points of those curves to create new curves you can manipulate however you want? Seems like your only condition is start and end points remain the same - is there anything else about the curve(s) you want to preserve?

Create new curves and make these do whatever you want with attractor points etc.

Because your curves lie on vertical planes, you can scale them vertically, on Z axis, and keep their planarity.
Some brute force:

Round the curves in length, keeping the same start and end point.gh (169.7 KB)

To make this work, as you are using an improper scale, you must change the precision of the document:

and then recompute grasshopper.

As for this method works, straight lines are skipped…

Hi Ftzuk
Sorry I probably wasn’t clear enough
I’m trying to change the shape just a bit enough to round off the length of the curves in a pre-fine pitch.
Basically, I had to transform the length in a divisible integer by my default denominator
Consider, for example 3 curves with the length:
1 - 8.5798m
2 - 9.769m
3 - 9.351m

If I set a pitch 1cm

1 - 8.580m
2 - 9.770m
3 - 9.350m

If I set a pitch 3 cm

1 - 8.580m
2 - 9.780m
3 - 9.360m

If I set a pitch 5cm

1 - 8.580m
2 - 9.80m
3 - 9.350m

Maybe now its cleaner
Thanks

Thanks Riccardo!

Super interesting !
I didn’t know he tries about the tollerance.
How can I change the pitch? like to 5 cm for example?
Thanks a lots

Like this:

Round the curves in length, keeping the same start and end point.gh (169.2 KB)
keep in mind that your base triangle have sides with length not multiple of anything… you probably should use a base triangle with integer (cm) lengths…

1 Like

Thanks again Riccardo
Yes, my base triangle still have sides with no multiple length. I m fixing this.

Your approach it’s really clever but unfortunately I notice that the Z values of ends point change a bit.

round curves length 3.gh (174.2 KB)
some curves are almost straight, and the script find the only solution to scale them like 17x vertically to make them round.
You will have to pick manually which to just round to straight lines.
5cm is much more strict than 1cm, and this happens…