| |
|
|
||||
![]() |
||||||
| |
|
|||||
|
Mathematical Definition of Bezier Curves A curve is defined geometrically by its control points. We also need a mathematical formula to represent the shape of the curve, so that it can be reproduced on-screen. This section presents a brief derivation of the Bezier curve, leading to Eq. 4, which presents a single function for evaluating the kind of Bezier curve we will be using. Higher degrees of equation allow more control points and therefore more complexly defined curves - all at the cost of greater computation time. Although it looks complicated, this representation is for a curve of arbitrary degree. In this article, we are going to deal with cubic curves, that it curves with n = 3. This kind of curve is defined by four control points and is particularly useful for defining FFDs. A Bezier curve is defined by a parametric equation of the form:
With the degree of curve fixed as 3, Eq. 2 can be expanded to produce four equations for
which are dependent only on the curve parameter u, as you can see in Eq. 3:
These functions are called the Bezier basis functions of degree three. You can use them to expand the sigma notation in Eq. 2. The result is a single function that we can use to evaluate the position on a cubic Bezier curve at any value of the parameter u:
We could draw the resulting curve by calculating the value of the function at a number of intervals and then connecting them with straight lines. Listing 1 shows code to evaluate Q(u) at any point on the curve. Listing 1 CVector3D CEvaluator::EvalCurve(CURVECTRLPTS
P, float u)
} |
|
|