 # How to place equidistant points along a curve?

(Konrad Kobayashi) #1

Hi,

I am a bit stuck ; but I think it should be easy…

Points on a curve should be placed in a way so the distance between them is equal. The first point should be at the start of the curve and the last one at the end.

Divide Curve will not work since the curve is not straight.
kangaroo will work but it seems a bit overkill / also many, many curves

thanks for any help!

divideCrv.gh (12.7 KB)

(Daniel Piker) #2

I think you won’t get away from needing some iterative approach to this.
Here’s a simple cluster that will work for multiple curves at once.

equalsegment_length.gh (17.2 KB)

2 Likes
(Konrad Kobayashi) #4

nice! really appreciated (Dale Fugier) #5

Here is a another simple example.

SampleDivideEquidistant.gh (4.6 KB)

– Dale

1 Like
(Konrad Kobayashi) #6

thank you, but it seems that the last point is not at the endpoint of the curve.
or am i missing something?

(Konrad Kobayashi) #7

if anybody wants to divide each curve into different spaced points: graft the “int” input

equalsegment_length_multiple_length.gh (17.4 KB)

#8

Have a look also in this thread (different solutions). The linked post has a component which refines the iteration algorithm until the end point is reached (IIRC).

// Rolf

2 Likes
(Seghier khaled) #9

check this , the last post : EqualizeSegmentsDivide.ghuser,

1 Like
(Konrad Kobayashi) #10

thanks, its actually a bit faster than the kangaroo version!

(Seghier khaled) #12

NURBs Curve PWK can create segment which have similar lengths but not equal 100%

(Konrad Kobayashi) #13

interesting, is there a difference between this and divide curve? it seems that it has the same characteristic, in that the segments get smaller in areas of high curvature. e.g. segment 6 is the shortest and sits right in the corner of the first bend.

(Konrad Kobayashi) #14

I was wondering if it would be possible with kangaroo to segement the curve so that not only the the distance between points (speed) is under a certain limit but also the acceleration and jolt.

To do this I would normally just use a while loop and decrease the segment lenght until the conditions are met.

Is there a smarter way?

thanks!

(Daniel Piker) #15

I’m not sure I follow - do you mean to keep the rate of change of consecutive segment lengths of the polyline under some limit? Or are you talking about the angles?

(Konrad Kobayashi) #16

I mean the curve derivative. I am a little out of my depht, so pease be forbearing with me.
When a curve is divided into segments the change of position between consecutive points can be understood as the speed of the curve.
If each equidistant point is reached with a timestep of e.g.: 1 second this will ensure a constant speed (the speed value is depended on the lenght of the segment and timestep).
But acceleration between points also depends on the angle between them.
What I am looking for is a sementation that ensures that all 3 criteria (speed, acceleration, jolt) are under a certain limit

(Konrad Kobayashi) #17

maybe the description was a little unclear. I will try again. ( non native speaker , complicated subject)
Let’s image a car moving along nurbs curve road. The car can move at different speeds but is very susceptible to forces acting on the car.

1. (speed) The first force is due to the speed the car is moving: at 100mph the windresistance is high enough that the windshild cracks
2. (acceleration) due to the bad construction of the car, it will break when the driver takes a tight turn without slowing down
3. (jolt) due to a almost broken gaspedal the driver can not push the pedal in a hard, (on/off) way but has to carefully and slowy lift or lower his foot.

Since years of experience with his bad car the driver knows just how to drive it right at the limit of breakage.

I wonder, overlooking the nurbs-curve road, where will the car be at time T?

my naive approach would be: when in doubt - drive slower. So:

``````calc next point:
while(speed,acc,jolt > limit) decrease timestep
``````

this would be an approximate solution and based on some kind of while loop

(Konrad Kobayashi) #18

here is my first attempt to solve this problem:
at the moment the script only cares about Δx/Δt so speed, but I hope I can code something so it takes acceleration and jolt into account.

I forgot that the car does a standing start and stop – so this will be quite challenging aswell

@ mcneel/mods : since this is a quite different question than the thread started – can or should it be split into seperate thread at post #17 ?

curvesampler_v2.gh (20.6 KB)