[Python] Algorithm to find curve with tangents at set distances along curve

Discussão em 'Python' iniciado por Stack, Agosto 17, 2025.

  1. Stack

    Stack Membro Participativo

    I'm looking to write (or ideally find) an algorithm for calculating an approximate curve given:

    • Start and End points
    • Tangents at given distances along the curve
    • Fixed overall length of curve

    So something like starting point (x_0, y_0) ending point (x_n, y_n) and a list of distances and angles [(a_0, 0), (a_1, d_1) ... (a_n, d_n)] where a_i is the tangent to the curve at distance d_i (along the curve) from (x_0, y_0) and d_n is the overall distance along curve from (x_0, y_0) to (x_n, y_n).

    As the input will be comng from real-world data there won't be a precise solution but some sort of iterative approximation would be suitable.

    My main problem is that I don't know if a class of curves like this have a name so I can search for it, ideally there will already be an algorithm I can use. Most things I've found assume know positions of control points.

    More information about the problem: it is actually in three dimensions but the range in the z direction is a lot smaller than than in x and y so for simplicity I think can be ignored. But for completeness, the z value is known at the start point, end point, and at every known tangent point.

    The whole curve also smoothly changes over time (but with overall length and distance along the curve of tangent measurements remaining the same) so the curve at the previous time-step could be used as the starting point for a iterative solution.

    I mainly work in python so if there is a numpy/scipy implementation that would be ideal.

    Continue reading...

Compartilhe esta Página