# Gradually divide curve with minimum spacing

Hello dear Grasshopper users,

I am trying to divide a curve gradually and my goal is to be able to control the gradient through the graph mapper component. For example I want to create a denser division at the start and end and a more loose division in the middle.

However, I want to be able to set a minimum distance, so the smallest distance between the points will be for example 100mm and it gradually increases.

Attached is a very basic way of dividing it with grasshopper so you can understand more clearly.

Your images show a good start but where is that GH file?

You could Shatter the curve at the ‘t’ values from Graph Mapper and display their lengths in the text panel, then modify Graph Mapper (and the number of points?) until your minimum distance (or is it length?). Either way, it depends on the curve length.

Sorry, I forgot to include it, but this was actually just a dummy to show what im trying to go for.
The actual script already kind of solves what I want to achieve, but depending how I manipulate the graph mapper component, it will not divide the curve from start to finish: Looks like you didn’t internalize your curves either. the geometry is not internalized for all curves…would you mind reupload it with all curves?

pretty sure Evaluate Curve is the element you will need and with a reparameterized curve

First crazyness of the day… Assuming you have N intermediate points on your curve, thus N+1 segments x0,…,xN :
L0, fixed length
xk = L0 + A*f(k)

Where 0<f(k)<1 is given for all k by the Graph Mapper.

The total length of the curve is `L = (N+1)*L0 + A*sum(f(k),k=0..N).` You can compute that amplitude factor A so the gradient adapts to your curve.

Then `Mass Addition` +` Evaluate Curve` to place all points.

The only guarantee that all xk are larger than L0 is that `N<=(L/L0-1)`.

EvaluateCurve.gh (25.0 KB)

5 Likes

My apologies, and excuse me for asking but how could internalizing the curves help you, when the issue is that Im using a plugin that you have not installed? And I have internalized the input curves for the script. Im sorry if I am not understanding the issue here.

Wow, thank you for your quick thinking and very promising solution! I see that what I was missing was the abiltity to understand the mathematical problem behind it, so I am glad that you helped me out. As far as I can tell, your solution is doing exactly what I want and now im able to input the minimum spacing and the number of divisions. Thats a big plus! Thank you very much!

It’s often possible to substitute standard GH components for Pufferfish components. @magicteddy’s code has no Pufferfish components. Unfortunately, he didn’t internalize his curve either. It’s tough to learn anything from broken code.

P.S. @magicteddy, I created my own curve but your code doesn’t like it. Broken code is useless!

P.P.S. Looks like I needed to adjust the minimum slider ‘L0’ for my shorter curve… But I see that the points are not evenly spaced even though my curve is symmetrical? EvaluateCurve_broken.gh (16.8 KB)

Probably because the Graph Mapper is not symmetrical ! 1 Like

It doesn’t resemble this image from the OP:

Thank you for your extended interest to solve the issue. For me, the problem is solved (as marked in the thread). Since the curve in my image is not symmetrical, it doesnt have a symmetrical division. However, @magicteddy 's solution provided exactly what I need. Changing the Graph mapper to a ‘Gaussian graph’ did divide it so that the start and end of the curve are divided with the minimum spacing input and then gradually increase towards the middle of the curve.