# How to get a point on curve with specified distance from a known point

I want to divide a curve with exact distances between points, but the distance is not always the same.
Divide Equidistant works great, but I am not sure how to just get the next point at a different specified distance.

Right now, I am using Divide Equidistant to get points at my first spacing, then splitting the curve at the point where I need a new spacing. Then Divide Equidistant on the remaining curve. Repeat… Is there a better way to get points spaced out along a curve at specified distances?

Ultimately, I guess I am asking how Divide Equidistant works so I can do my own incremental Divide Equidistant.

I have considered that I could put a sphere around the point and do sphere curve intersection and try to filter out the other intersections, but this seems slow and very error prone.

Next thought is that I could get the tParam of the point, add the distance to tParam and check the distance. This would work in one step on lines, but I would have to while loop and adjust the tParameter until the distance between the points is within a tolerance… this sounds like it would work, but would require some tuning to get reasonable performance.

Is there a more direct way of calculating where the next point at a specified distance would be along a curve? Seems like Divide Equidistant runs really fast, so I am guessing there is a way that takes curvature into account so the next point can be calculated instead of incrementally solved.

do you need to solve this in 2d = planar or 3d ?

why not implement your first idea “sphere curve intersection” (which will be a Brep-Curve intersection ) and see if the performance is fast enough ?

I did a fast test: 1024 curves intersecting with 4 spheres resulting in around 7000 points.
It took for sure less than a second. Maybe 0.3 seconds ?

Thank you for the reply. That looks like a great test!

I actually ended up using the divide equidistant at the first known distance, then when I find a new distance is needed, I split the curve and divide equidistant again. This was pretty easy to implement so I tried it out first.

I will likely come back later and try out the sphere intersection concept to see what performs better. My fear is that geometric intersections on explicit geometry is a little finicky. Also, I would be generating a sphere for every division point, getting multiple points back (sometimes more than two) then filtering out all but the one I want by checking the closest point on the curve to get each point’s tParameter… this starts to sound expensive.

I am guessing that under the hood rhiniocommon is actually doing tParameter adjustments until it reaches the desired length, but I could be wrong. Seems like a steepest decent algorithm on the tParameter would get you the right answer very fast and reliably.

Here’s a related discussion that is pretty interesting.
http://forums.cgsociety.org/t/divide-curve-equidistant-straight-line/1557425/7

And here are more talks using circles and spheres for distribution