findCusps
Finds cusps in this contour: points where a single Bezier segment's own parametric speed drops to (near) zero and the direction of travel reverses or becomes undefined - a genuine fold in the curve. This is distinct from an ordinary sharp corner between two segments, which has perfectly well-defined (merely discontinuous) tangents on either side and is not reported here.
A cusp can only occur inside a segment: a cubic segment's velocity B'(t) is itself a quadratic-in-t vector (its "hodograph"), and a cusp is exactly where that hodograph passes through - or very near - the origin. Finding it is then a matter of locating the critical points of the speed-squared function |B'(t)|^2; since its derivative 2 B'(t) . B''(t) is an exact cubic polynomial in t (quadratic segments degrade this to a linear one, linear segments have constant, never-zero speed and are skipped), every candidate can be found directly via solveCubic rather than by sampling - so a cusp confined to a tiny fraction of a segment's domain can't be missed between samples.
Return
the global contour parameters (in the same ut space as ShapeContour.position) of every detected cusp, ascending and with near-duplicates (e.g. a cusp landing on a shared vertex) merged.
Parameters
a candidate point is accepted as a cusp when the segment's speed there drops below this fraction of the segment's own length - a relative test, so it scales with the contour's own units instead of requiring an absolute distance.