Controlling the B-Spline

text only
 
progress indicator progress indicator progress indicator progress indicator

NURBS: Rational Splines

NURBS is short for "Non Uniform Rational B-Spline". From the previous chapters, you should be familiar with each of those terms except for "rational". To define rational curves, I must first define rational numbers. A number is rational if it can be represented as a quotient of two integers. Most of the numbers you deal with on a daily basis are rational numbers . For example, the number 5 can be represented as 5/1, 10/2, and so on. There are a few notable exceptions-the most common one being pi. There are no two integers for which the quotient equals pi. There are approximations, such as 22/7, but pi cannot be exactly represented as a quotient and is therefore an irrational number.

Coming back to the context of curves, NURBS are defined as rational curves because their basis functions are given as the quotients of two polynomials . In light of this, the B-spline curves of Chapter 4 are irrational curves, but this is usually not explicitly mentioned.

To understand where this quotient comes from, I need to again depart from curves for a moment. As a result of some of the mechanics of matrix operations, graphics equations are frequently expressed in terms of four-dimensional homogenous coordinates. In a homogenous coordinate system, XYZ points are usually given as XYZW coordinates during transformations. When they are projected back into 3D space, the new coordinates are given as (X/W, Y/W, Z/W).

If you define irrational B-splines in 4D space and then project them back into 3D space, you obtain NURBS with basis functions given by the following equation.

(5.1) Basis function for NURBS. 

In this equation, it usually makes the most sense to think of the W parameter as a "weight" for each control point. This is usually given as a homogenous coordinate vector or weight vector [W], similar to a knot vector. If you choose to, you can ignore the mathematical intricacies of rational numbers and homogenous coordinates and concentrate on the effects of a weighting factor for each control point. These weight factors have three main effects that offer advantages over the Bsplines of Chapter 4.

First, unlike irrational B-splines, NURBS are invariant with respect to both affine and perspective transformations. B-splines are only invariant with respect to affine transformations (scaling, rotation, and translation). This means that you can perform perspective transformations on the control points and compute proper curve points with the transformed control points. This saves you the computational overhead of transforming every point along the curve. With hardware transformations, this may become less of an issue, but it can be an advantage.

Second, the ability to change the weighting factor of each control point gives you more control over the shape of the curve. In the previous chapter, I presented B-splines as a set of building blocks or controls that affected the shape of the curve. NURBS give you one more control, as you will see in the next section.

Finally, NURBS can be used to correctly draw conic sections such as circles. This can be extremely useful when drawing real-world shapes . I will go into more detail about conic sections later in this chapter.

These three factors make NURBS very effective as basic modeling primitives. In fact, programs like Rhino3D are almost entirely based on NURBS.

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