I need to determine points of inflection (points where the curvature changes) on a 2d Bezier curve, parameterized by t, 0 <= t <= 1, if they exist. My original method was to sample along the curve, evaluating second derivatives and finding the point where the derivative’s sign changes.
2DVector curvature1, curvature2;
for (double t = 0, t <= 1.0; t += STEP) {
curvature1 = bezier.CurvatureAt(t);
curvature2 = bezier.CurvatureAt(t + (STEP/2.0 >= 1.0 ? 0 : t + STEP/2.0));
if (isNegative(curvature1) ? isPositive(curvature2) : isNegative(curvature2)) {
inflection_point = t;
}
}
where CurvatureAt() is a method that evaluates the second derivative of the bezier at t, but as the bezier curve is a vector valued function the derivative is returned as a 2D vector (not std::vector, a 2D vector class). I dont know how to interpret “where the sign changes” for vectors. Basically i dont know how to write isNegative or isPositive in the above snippet.
are there any other ways to find points of inflection on a 2d Bezier curve?
I dont think its possible to determine a closed form solution to this problem because the Bezier can be of arbitrary degree, however please correct me if I’m wrong here.
Curvature is related to but not the same as second derivative.
The signed curvature of a parametric curve
P(t) = (x(t), y(t))is actually a number and is defined as:If you use this formula your original idea should work.