How Should This Book Be Read?

text only
progress indicator progress indicator progress indicator progress indicator

Bezier Curves Defined in Parametric Terms

Prior to CAD/CAM tools and high-precision machining, engineers and draftsmen drew curves in very imprecise ways. Typically, they would mark a few points along the curve and then use a French curve or something similar to draw a best-fit curve through the points. This approach became unacceptable with the introduction of computer-aided manufacturing because suddenly, automated machines could make very precise parts, but there was no way to describe these precise parts . Pierre Bezier was confronted with this problem while working for Renault in the 1960s. He invented Bezier curves as a way of precisely describing every point along a given curve. Computer-driven manufacturing machines could now be used to precisely and reliably produce the curve. Like most great inventions , other inventors were doing similar work simultaneously , but Bezier's name is the one that has been attached to this particular invention.

Note 

In Chapter 4, "B-Splines," you will learn that Bezier curves can be thought of as a specific case of B-splines. In this chapter, I will explain them in strictly parametric terms in order to set the stage for the more general formulation of B-splines.

Some of the mathematical concepts that led up to the formulation of Bezier curves are beyond the scope of this book and not terribly important for the practical user , so I will describe the formulation in basic geometric terms. I have talked about simple parametric equations for lines. Now, I will extend those concepts to curves. To go beyond a simple linear curve, you need at least three points. These three points are called control points and you can connect them to form a control polygon . Figure 3.2 shows a quadratic curve derived from three control points.


Figure 3.2: Three control points and the resulting quadratic curve.

Before I talk about how to create this curve with parametric equations, consider a very simple geometric approach. The curve in Figure 3.2 can be created using a basic subdivision technique. For each line segment, create a point at the midpoint and join the resulting points. Repeat this until the line segments are very short and you generate a smooth curve. Figure 3.3 shows several steps of this technique.


Figure 3.3: Creating the quadratic curve with subdivision.

If your only task was drawing this one curve, the geometric method would be all you need. In a real situation, you'd quickly find that this technique is fairly limited. If any of the points changed, you'd have to repeat all of the subdivision steps to produce even a single point. Clearly, you would like a way to describe any point along the curve as a function of the control points. This would allow you to compute points as a function of the control points without subdividing the entire curve. This sounds like a job for a parametric function.

Figure 3.4 shows the same set of control points as Figure 3.2, only now I am defining points along the two line segments using the parametric line equation shown in Equation 3.1.


Figure 3.4: Describing points on the two line segments.

Now, connect Q1 and Q2. Figure 3.5 shows how the point Q3 can be described with a parametric equation involving Q1 and Q2.


Figure 3.5: Connecting the points with another parametric line.

So, for any value of t, you can find a point on each line segment, connect them, and find a point on the new line segment. This point is Q3 from Figure 3.5. The location of Q3 is a function of t and the points Q1 and Q2, which are given by functions of A, B, C, and t. Therefore, you can collapse these individual parametric equations to yield the location of Q3 as a function of the control points and t as shown in the following set of equations (see Equation 3.5).

(3.5) Q3 as a parametric function of the control points. 

The final form of Equation 3.5 will yield the same quadratic curve shown in Figures 3.2 and 3.3. This is in fact the equation for a quadratic Bezier curve. You can restate this equation as the sum of a set of basis functions multiplied by the corresponding control point. Equation 3.6 shows how these equations are normally stated.

(3.6) Point on a Bezier curve expressed in terms of basis functions. 

These basis functions are known as Bernstein polynomials. They determine how much each control point influences the curve for any value of t. The three basis functions shown in Equation 3.6 correspond to a set of three control points, but Bezier curves can have any number of control points. The Bernstein polynomials for a given number of control points can be determined with the following equation.

(3.7) The general equation for Bernstein polynomials. 

The disadvantage of using more control points is that the amount of computation for each point on the curve grows as the number of control points increases . Therefore, most people limit the number of points to either three or four. For the remainder of this chapter, I will be talking about four control points, which yield a cubic Bezier curve. The basis functions for cubic curves can be derived from Equation 3.7, but they are explicitly shown in Equation 3.8 for clarity.

(3.8) Four basis functions for a cubic Bezier curve. 

In this and other chapters, it is sometimes useful to be able to visualize the basis functions. Figure 3.6 shows graphs of the four basis functions as functions of t. The interval for t is [0, 1] and the range of the basis functions is also [0, 1].


Figure 3.6: Graphs of the four basis functions.

Figure 3.6 reveals several characteristics of the basis functions and of Bezier curves in general. First of all, the sum of all the basis functions at any value of t is equal to 1. Also, each basis function affects every point along the curve except at the endpoints, where only the first and last control points affect the first and last points. Therefore, the endpoints of the control polygon are also the endpoints of the curve itself.

Figure 3.6 also reveals some serious limitations of Bezier curves. Each control point affects every point along the curve (except the extreme endpoints). This means many control points will require more computations when evaluating points on the curve. The result is that the number of control points determines the degree of the curve. The degree of the curve is always one less than the number of control points. Also, any changes to any of the control points will change every point along the curve (except the endpoints) in some way. This means that you have no local control . This is a problem with Bezier curves (and third-world governments ) and it severely limits the amount of flexibility you have when determining the final shape of the curve. For these reasons, people will typically form curves by stringing together several cubic curves instead of forming one curve with many control points. This is a great time to talk about how to do that.

progress indicator progress indicator progress indicator progress indicator


Focus on Curves and Surfaces
Focus On Curves and Surfaces (Focus on Game Development)
ISBN: 159200007X
EAN: 2147483647
Year: 2003
Pages: 104
Authors: Kelly Dempski

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net