# Points moving on curve with a minimal distance in grasshopper

How would i approach creating something like this ? im stuck

this should be possible with using a number of evaluate curve components.
you create the curve and define a list of parameters.

i did , but the points will overlap , i wrote a text on the image it explains what i need!

yes, i realize that, thatâ€™s why i suggested that approach, even if the description is full of ambiguities.

thatâ€™s why you need to upload your gh, because youâ€™re probably not using the components correctly

point_on_curve.gh (12.9 KB)

try this
the logic should be simple to understand
you first define the intervals (there are two methods)
and then define how an intermediate point is defined on each interval

ordered points on curve.gh (15.8 KB)

if you want to include the endpoints, make sure the first and last parameters are 0 and 1

remember to match the outputs of the explode tree component

rember to add as many evaluate point components are there are segments/intervals

thank you sir but i dont think you understood what i mean , check these 2 steps

Iâ€™ll be completely honest, if what i sent you is not it, i still donâ€™t understand what you mean

Maybe retry the explanation. Iâ€™m sure what youâ€™re trying to do makes sense, but youâ€™re not communicating it it so that it makes sense to me

Iâ€™m looking at that diagram and what it says to me is create points between segments and keep the order.

The text i donâ€™t fully understand, maybe you want to move a point, sometimes you can, sometimes you canâ€™t, itâ€™s all confusing

Try to formalize the problem

you have points that are dividing a curve you can move each point on the curve up and down but if you move for exemple the pink point in the picture(f1) then it becomes a red point in pictur(f2) but the next point which is purple , since pink is so close to purple, the purple point cant move down now , only up! imagine if each point is a sphere in real life spheres cant push each other! do you get what i mean?

my god, this is the only thing that makes sense.
one of the things i tell my students is to make sure they use the right diagrams and words to explain an idea.
you should become my student

well, its a trivial problem, for the simple case of a nice curve, a complex problem if you want to generalize it (curves that fold back on themselves, self intersect, have really sharp kinks, etc)

so
itâ€™s not exactly what you need, but with simple grasshopper components this is what you can easily get

how it works:

1. each point has a position parameter, a maximum parameter, and a padding parameter
2. the minimum parameter of each point P(n) is the maximum parameter of P(n-1)
3. for each Pn , it checks if its positional parameter is larger than Pn-1 + padding, and smaller than its maximum

caveats:

1. instead of unit length, thereâ€™s a parametric â€śminimal distanceâ€ť between the points - i call it padding
2. because thereâ€™s an order of operation imposed by grasshopper, earlier points will have positional priority `-> meaning that if you move p2 closer to p1, p1+padding will block p2, but if you move p1 towards p2, p1+padding will move p2`

solutions:

1. to convert the numbers from parameters to units length, you will have to do a bit of extra calculation

2. create custom c# script that incorporates a cyclic feedback loop, and checks for priority in order of change, not in order of operation â†’ meaning that moving p3 (for example) will give it priority less than p2 and p4 â†’ meaning that you have to store data in persistant memory, so you can check for last position, last change, is changing now, etc.

but here the points could get out of the curve?

just imagine that the points are spheres like this picture!

small bug. flip those

as in

i gave you everything you need to solve the problem. try to understand the algos and make the required adjustments. good luck

@amir_kharrat try to understand this section

thank you sir! just one last thing! if i try to move the 3rd point onto the 4th point they get overalapped! even tho the padding value is bigger than 0?

also figured that these dont really set the max and eval param for point 2

they work fine for other points but only those 3 sliders for pt 2 dont work proprely

try to keep all the value evenly distributed and only have the last point with a max of 1

1 is the end of the curve
so if you put a point on the end of the curve, then all subsequent points will be at the end.

later points cannot push back earlier points.
understand this