Calculate cubic bezier T value where tangent is perpendicular to anchor line.
Posted
by drawnonward
on Stack Overflow
See other posts from Stack Overflow
or by drawnonward
Published on 2010-04-20T05:22:34Z
Indexed on
2010/04/20
5:43 UTC
Read the original article
Hit count: 326
Project a cubic bezier p1,p2,p3,p4 onto the line p1,p4. When p2 or p3 does not project onto the line segment between p1 and p4, the curve will bulge out from the anchor points. Is there a way to calculate the T value where the tangent of the curve is perpendicular to the anchor line?
This could also be stated as finding the T values where the projected curve is farthest from the center of the line segment p1,p4. When p2 and p3 project onto the line segment, then the solutions are 0 and 1 respectively. Is there an equation for solving the more interesting case?
The T value seems to depend only on the distance of the mapped control points from the anchor line segment.
I can determine the value by refining guesses, but I am hoping there is a better way.
© Stack Overflow or respective owner