Closest point on cubic bézier curve

Started by
0 comments, last by Dave Eberly 12 years, 11 months ago
I'm trying to find the point on a cubic bézier curve closest to another external point P, in 2D space. I've read the Graphics Gems explanation on the method and other stuff but the math's way over my head. Specifically I don't really understand how finding the roots of the.. curve's polynomial (am I making sense?) gets you closer to the solution. Would somebody be able to explain this in a 14 year old's terms? (:
Advertisement

I'm trying to find the point on a cubic bézier curve closest to another external point P, in 2D space. I've read the Graphics Gems explanation on the method and other stuff but the math's way over my head. Specifically I don't really understand how finding the roots of the.. curve's polynomial (am I making sense?) gets you closer to the solution. Would somebody be able to explain this in a 14 year old's terms? (:



Generally, let the curve be parameterized by (x(t),y(t)) and let P = (p0,p1) be the external point. The vector from the closest point on the curve to P must be normal to the curve, which means that vector is perpendicular to a tangent of the curve. Such a tangent is the derivative (x'(t),y'(t)). The vector from a curve point to P is (x(t)-p0,y(t)-p1). To be perpendicular, the dot product is zero: 0 = x'(t)*(x(t)-p0) + y'(t)*(y(t)-p1) = f(t). When (x(t),y(t)) has polynomial components, f(t) is a polynomial. So the problem reduces to finding roots of f(t). In your case, x(t) and y(t) are degree-3 polynomials, x'(t) and y'(t) are degree-2 polynomials, so f(t) is a degree-5 polynomial. There are no closed-form equations for roots of degree-5, so you must use a numerical method for root finding.

This topic is closed to new replies.

Advertisement