Saturday, February 21, 2009

Bezier Curves

Linear Bézier curves

Given points P0 and P1, a linear Bézier curve is simply a straight line between those two points. The curve is given by

\mathbf{B}(t)=\mathbf{P}_0 + t(\mathbf{P}_1-\mathbf{P}_0)=(1-t)\mathbf{P}_0 + t\mathbf{P}_1 \mbox{ , } t \in [0,1]

and is equivalent to linear interpolation.

[edit]Quadratic Bézier curves

A quadratic Bézier curve is the path traced by the function B(t), given points P0, P1, and P2,

\mathbf{B}(t) = (1 - t)^{2}\mathbf{P}_0 + 2(1 - t)t\mathbf{P}_1 + t^{2}\mathbf{P}_2 \mbox{ , } t \in [0,1].

A quadratic Bézier curve is also a parabolic segment.

TrueType fonts use Bézier splines composed of quadratic Bézier curves.

[edit]Cubic Bézier curves

Four points P0, P1, P2 and P3 in the plane or in three-dimensional space define a cubic Bézier curve. The curve starts at P0 going toward P1 and arrives at P3 coming from the direction of P2. Usually, it will not pass through P1 or P2; these points are only there to provide directional information. The distance between P0 and P1 determines "how long" the curve moves into direction P2 before turning towards P3.

The parametric form of the curve is:

\mathbf{B}(t)=(1-t)^3\mathbf{P}_0+3(1-t)^2t\mathbf{P}_1+3(1-t)t^2\mathbf{P}_2+t^3\mathbf{P}_3 \mbox{ , } t \in [0,1].

Modern imaging systems like PostScript, Asymptote and Metafont use Bézier splines composed of cubic Bézier curves for drawing curved shapes.

 

Constructing Bézier curves

[edit]Linear curves

Animation of a linear Bézier curve, t in [0,1]

Animation of a linear Bézier curve, t in [0,1]

The t in the function for a linear Bézier curve can be thought of as describing how farB(t) is from P0 to P1. For example when t=0.25, B(t) is one quarter of the way from pointP0 to P1. As t varies from 0 to 1, B(t) describes a curved line from P0 to P1.

[edit]Quadratic curves

For quadratic Bézier curves one can construct intermediate points Q0 and Q1 such that as t varies from 0 to 1:

  • Point Q0 varies from P0 to P1 and describes a linear Bézier curve.
  • Point Q1 varies from P1 to P2 and describes a linear Bézier curve.
  • Point B(t) varies from Q0 to Q1 and describes a quadratic Bézier curve.

Construction of a quadratic Bézier curve
Animation of a quadratic Bézier curve, t in [0,1]

Construction of a quadratic Bézier curve
Animation of a quadratic Bézier curve, t in [0,1]

[edit]Higher-order curves

For higher-order curves one needs correspondingly more intermediate points. For cubic curves one can construct intermediate points Q0, Q1 & Q2 that describe linear Bézier curves, and points R0 & R1 that describe quadratic Bézier curves:

Construction of a cubic Bézier curve
Animation of a cubic Bézier curve, t in [0,1]

Construction of a cubic Bézier curve
Animation of a cubic Bézier curve, t in [0,1]

For fourth-order curves one can construct intermediate points Q0, Q1, Q2 & Q3 that describe linear Bézier curves, points R0, R1 &R2 that describe quadratic Bézier curves, and points S0 & S1 that describe cubic Bézier curves:

Construction of a quartic Bézier curve
Animation of a quartic Bézier curve, t in [0,1]

Construction of a quartic Bézier curve
Animation of a quartic Bézier curve, t in [0,1]

(See also a construction of a fifth-order Bezier curve.)

 

 

From: http://en.wikipedia.org/wiki/Bézier_curve

No comments:

Post a Comment

Google+