Derivatives of Polynomial Functions

text only
progress indicator progress indicator progress indicator progress indicator

Generating Closed Shapes with B-Splines

In addition to curves, it is also beneficial to talk about closed shapes. This will become especially important in the later chapters where I will be talking about three-dimensional objects created with parametric curves. In the present context of curves, a closed shape is simply a curve where the end points meet.

At first thought, this may seem like an easy problem to solve because you can just set the start and end point to the same position. Because of the behavior of a B-spline, this isn't exactly the case. Consider for a moment a curve created with an open knot vector. The end points of the curve are coincident with the end points of the control polygon. For the sake of creating a closed shape, this sounds perfect. However, there is a problem in that the slopes of the end of the curve match the slopes of the last span of the control polygon. That means you will have continuity problems where the two ends join. This is shown in Figure 4.21.


Figure 4.21: Continuity issues with a closed shape.

There are times where the kink you see in Figure 4.21 might be exactly what you need, but in many cases you will want a smooth shape. This would be very difficult with an open knot vector because of the way the slopes of the end points work out.

Look at how the basis functions of the two ends match up. Figure 4.22 shows the set of basis functions for the curve repeated so that the curve continues into itself. Speaking strictly in terms of the shapes, you can see that the joined ends of the curve do not follow the same pattern as the rest of the basis functions.


Figure 4.22: Relationships between repeated basis functions.

I point out the relationships between the shapes of the basis functions because you do have an option where the shapes of the basis functions follow a repeating pattern. A periodic knot vector has continuity properties that are very useful for joining the ends by virtue of the periodicity of the basis functions.

Having said that, once you move to periodic knot vectors, you lose the convenience of the curve beginning and ending with the ends of the control polygon. As Figure 4.23 shows, a closed control polygon does not equal a closed shape.


Figure 4.23: Incomplete shape from a periodic knot vector.

It turns out that there is an easy fix for this. You can complete the shape by adding (k-2) control points around the control polygon. This will pull the ends together, giving you a complete shape with smooth continuity. An example is shown in Figure 4.24.


Figure 4.24: Closing the shape with more control points.
Note 

Figure 4.24 shows a triangle as the simplest closed shape. It is a coincidence that (k-2) more control points is also one more complete trip around the triangle. I don't want to give the false impression that all closed shapes require a second complete set of control points. The requirement is (k-2) extra control points.

Once you have set up the proper control points, you can manipulate the shape just like you would any other curve. Just remember to move the coincident control points equally to avoid breaking the closed shape. In the next chapter, I will show a slightly different method of producing shapes and later I will show how to use these 2D shapes to build 3D objects.

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