homepage      gallery       guestbook  

                                                                     Curves and Surfaces

 

    I will try to provide a general overview of the essentials that you need to know before you can start fiddling with the demos. My intention is get your feet with regard to curves and surfaces so that you can understand whats happening in the demos.

Now, Whenever you want to define a curve or a surface the end product that you want is a set of points that is going to represent the actual curve or the surface that you wish to define. To arrive at this set of points, you need two things,

i) A set of control points

ii) A set of basis functions

 

The points of the curve or the surface will be derived as a weighted combination of these control points. You can think of it as an complicated average of the various control points. How much each of these control points contribute to final position of the curve or the surface point is determined by a set of equations called the basis functions. The basis functions determine how the control point positions are interpolated to determine the surface points of the curve or surface.

 

As for as the difference between the curves and the surfaces are concerned, the basic math for deriving the basis functions (the equations that defines the shape of the curve or surface) is the same. The difference is that, for curves these basis functions are applied along a single parametric direction (usually named ‘t’ with values ranging from 0 to 1 across the entire length of the curve). Whereas for surfaces the basis functions are applied along two parametric directions covering the entire surface (usually labeled ‘u’ & ‘v’ with values ranging from 0 to 1 across the entire surface).

 

In the following discussion all the concepts apply commonly to both curves and surfaces. Now, as far as Bezier curves are concerned, each of the control points affect every point on the surface. Bezier curves are not very good at providing localized control, this is where NURBS and B-Splines come into the picture. As such Bezier curves and surfaces leave very little room for flexibility. The following is a demo of a Bezier surface with 16 control points. Try moving around the control points to visualize how Bezier surfaces behave.

 

               

                        EXECUTABLE                SOURCE CODE

 

    B-Splines can be considered to be a super set of Bezier Curves. They can do everything that a Bezier curve can do, plus more! One of the benefits of B-splines over Bezier curves is that B-Splines provide localized control. They provide a mechanism for controlling the extend of influence of each control point across the surface. Using a mechanism called the Knot vectors, the control points can be made to affect only a particular region of the surface instead of the whole surface. Another advantage of B-Splines is that they provide a mechanism for controlling the smoothness of a curve or surface.Theres a term called the ‘order’ of the curve that determine the smoothness of a curve. In case of Bezier curves the ‘order’ of the curve is always equal to the number of control points, which means that for a fixed number of control points the smoothness of the Bezier curve is going to remain the same.

On the other hand, B-Spline curves give you the ability to change the order of the curve or surface independent of the number of control points. For example, a B-Spline curve having four control points can have an order of either 1,2,3 or 4. With order ‘4’ producing the smoothest possible curve and as the order of the curve reduces the smoothness of the curve also reduces. A B-Spline curve having ‘K’ control points can have an order value ranging from 1 to K.

The following is a demo of a B-Spline surface, You can try changing the order of the surface from 1 to 4 by hitting the corresponding number keys on the keyboard. You will notice an instant change in the smoothness of the surface. Also notice that when you set the order of the curve to 4,the resulting surface will be the same as the Bezier surface from the previous demo. This goes to show you that Bezier curves and surfaces are only a special case of the B-Splines.

               

                     EXECUTABLE                    SOURCE CODE

Next is a demo of a B-Spline curve,The executable is available, but you can try recompiling the source by changing the number of control points and the order, to produce different curve of varying smoothness.

 

 

                        EXECUTABLE                       SOURCECODE

And finally the NURBS also known as Non-Uniform Rational B-Splines are considered to be the super set of both Bezier and B-Splines. They offer more control than Bsplines. To put it simply, NURBS offer a way to add more ‘Weight’ to control points thereby offering ways to increase or decrease the overall influence of those control points in determining the shape of the curve. The following is a demo of a NURBS curve its very similar to the B-Spline curve except for the additional ability to add weights to control points. I suggest that you try playing around with the weight values in the source code and see the resulting difference. Notice how when you change the weight of the control points, the overall shape of the basis function graphs at the bottom of the screen changes.

                   

                                EXECUTABLE                        SOURCE CODE

 

 

                © 2004-6 Celambarasan Ramasamy. All rights reserved.