kjerandp / curve-interpolator

Interpolate values over a cubic Cardinal/Catmull-Rom curve
https://kjerandp.github.io/curve-interpolator/
MIT License
49 stars 6 forks source link

How to know the curvature #13

Closed pedefe closed 1 year ago

pedefe commented 3 years ago

Hello, How to know the curvature (R (radius), and so K=1/R) at each point of the curve ? Best regards.

kjerandp commented 3 years ago

You can currently get the derivative at a given point on the curve using core functionality, but I guess you would need the second derivative for this as well. I'll labeled it as an enhancement, and will try to find some time implementing it, as I'm sure it's useful.

pedefe commented 3 years ago

One usage is the autonomous vehicle following a path, as described on https://www.a1k0n.net/2018/11/13/fast-line-following.html . Main needs are nearestPoint, distance, normalVector , curvature or radius of the curve at this nearest-point on path. Similar properties are provided by Paper.js, but there are too much functionalities regarding your lib.

kjerandp commented 1 year ago

Functions for getting curvature (including radius and direction) and position of nearest point, normal vector and more in latest release (v3.1.0)