Bézier inversion

From CGAFaq

(Redirected from Bezier t at Point)
Jump to: navigation, search

Because a Bézier curve is a polynomial curve, we can use the algebraic geometry technique of inversion to find a ratio of polynomials in x and y that yield the parameter t at those coordinates. However, this can fail at double points and for degenerate curves. For example, the cubic curve with control points

(0,0) (2/3,1) (1/3,1) (1,0)

can be handled, except at its cusp, using the formula

t = (3x - y) / (3 - 2y)

Depending greatly on the proximity to a double point, and to a lesser extent on the polynomials chosen for the ratio, small perturbations in x and y can cause large displacements in t.

Here are four examples to illustrate:

Cubic Bézier control points An inversion formula
(0,0) (2,23) (−13,43) (13,13)
(1,1) (0,0) (0,1) (1,0)
(0,0) (23,1) (13,1) (1,0)
(0,1) (23,−1) (13,43) (1,0)

In general, you'll need to find t closest to your search point. There are a number of ways you can do this. In [Gems I, 607] there's a chapter on finding the nearest point on the Bézier curve. Digitizing the Bézier curve can also be an acceptable method. Or you can try recursively subdividing the curve, see if your point is in the convex hull of the control points, and checking is the control points are close enough to a linear line segment and find the nearest point on the line segment; using linear interpolation and keeping track of the subdivision level, you'll be able to find t.

See also

Personal tools