# Closest point on cubic bézier curve

This topic is 2779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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? (:

##### Share on other sites

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.

1. 1
2. 2
3. 3
Rutin
13
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633697
• Total Posts
3013404
×