Closed sopgenorth closed 2 years ago
Hi @sopgenorth,
TinySpline has no built-in function to express a spline's curvature as another spline function. However, TinySpline provides all functions needed to calculate the curvature of a spline at certain knots. Based on your link, the following code should give you the curvature of spline s
at knot t
:
BSpline d1 = s.derive(); // first derivative
BSpline d2 = d1.derive(); // second derivative
Vec3 CP = d1(t).resultVec3(); // C' as Vec3
Vec3 CPP = d2(t).resultVec3(); // C'' as Vec3
double val = std::pow(CP.magnitude(), 3) / CP.cross(CPP).magnitude();
You can use this to build your own spline curvature function.
Note: Always consider division by 0! You should handle the case:
CP.cross(CPP).magnitude() < eps // eps > 0
Could you solve your issue? If yes, please close this issue.
I'm closing this issue. Feel free to reopen it if necessary.
Is it possible to get a continuous function with a spline curve representing its curvature?
Or must this be evaluated with some strategy on a point by point basis, similar to: https://stackoverflow.com/questions/56586756/find-the-radius-or-curvature-at-a-point-on-a-bspline-using-geomdl-nurbs
Or are there better ways to evaluate the curvature of a spline that anyone here might be aware of?