Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

Curves and Surfaces by ZSsIui

VIEWS: 10 PAGES: 9

									Curves and Surfaces


Introduction to Curve and Surface Geometry
One of the biggest problems faced by vendors of Computer Aided Design products is the challenge
of developing suitable software for drawing complex curves and surfaces. These notes provide an
introduction to the topic and explain the major techniques that have been developed by
mathematicians, engineers and programmers in order to make possible the construction of complex
2D curves and 3D surfaces.
 The ability to construct complex shapes, and subsequently manufacture products incorporating
them has been a major aspect of competition in many industries. Shapes such as wing profiles and
ship hulls are examples of complex functional shapes, but in many industries geometry is employed
to produce aesthetically pleasing surfaces. It is not surprising that many of the major developments
in curve and surface technology have occurred in the car industry where a combination of function
and style are vital.
 Traditionally engineers drew curves using spline methods. These were techniques that employed
pliable materials (such as lead strips) that could be curved around pins attached to pieces of wood
to produce very smooth curves that could interpolate through control points (i.e. the pins). In the
shipbuilding industry, very long curves were required and normally the only part of the building
that was long enough to house this activity was the loft, so the practise of drawing spline curves
became known as ‘lofting’. Today this expression is still used and the computer analogies of
splines bear the same names. Splines that pass through chosen control points are called
‘interpolation splines’ and those that are merely pulled toward control points are called
‘approximation splines’. We will now consider the methods that have been used to construct
computer splines.

Simple Curves and Simple Geometry
We all know from our early maths that the equation of a straight line is as follows

                                              y = ax + b

                                 Simple equation of a straight line

This equation is based on the description of a line as a gradient and intercept. To describe a line
segment we would specify two values of either x or y to bound the chosen line.
This method of describing a line is simple, but does have drawbacks. Firstly it does not cope very
well with vertical lines! We could of course revert to an explicit equation with x as a function of y
but that only transfers the problem to horizontal lines. A better way to describe line segments may
therefore be to use parametric curves, so our new straight line equation becomes:
                                             x = a1 + b1t
                                             y = a2 + b2t
                                             z = a3 + b3t
                               Parametric equations of a straight line

or in vector notation……………..
                                            S(t) = A + Bt

                          Parametric vector equations of a straight line
This method allows us to easily draw robust straight lines. We can set the general nature of a
straight line by changing the coefficients A and B. Straight lines are therefore easy, but now let us
consider a simple curve. This can be represented by say a quadratic, cubic, quartic, quintic etc.
polynomial like so:

                               S(t) = A + Bt + Ct2 + Dt3 + …………

                                 Power basis equation for a curve

This method of describing curves uses as its 'basis', a series of powers of the independent variable
and is therefore known as a 'power basis polynomial'. This may work well for the straight line
where the meaning of the coefficients A and B is clear, but what is the meaning of C or D etc? If
we want to draw higher order curves we might be better to use meaningful design variables. Spline
curves are usually drawn using design variables that are meaningful to the designer, typically these
are the positions of a set of control points through or near which the curve will pass.

Interpolation Splines
 Perhaps the simplest way of describing curves for the designer is to consider a set of co-ordinates
for each point to be interpolated, as with a parametric curve. These splines are clearly analogous to
our early example of the techniques used by the shipbuilding industry. This is indeed a useful
method, but given a set of m+1 points, we would need a curve of degree m to describe our shape.
With many points we end up with very high degree curves. In order to plot the curves we have to
find interpolating values of the polynomial coefficients and this involves the solution of potentially
large sets of simultaneous equations. These curves can also easily become too 'squiggly' for the
designer's liking and they offer no local control. In practice these problems are usually overcome by
using only, say, cubic curve segments and which are joined or knotted together to form piecewise
curves that can interpolate many points.
The simple method of making piecewise curves can use Lagrangian interpolation methods to fit
curves (typically cubic, ie degree m=3) through m+1 (typically therefore 4) control points.
Another method of developing piecewise interpolation splines is to use Hermite interpolation. This
involves design variables describing not just control points but also those describing the tangent of
the curve at that control point. This has the advantage that local control over the curve is possible
since any action taken at a control point will only affect the curve to either side of the point since
on reaching a subsequent point the position and slope of the curve is set.




 Figure 1:Lagrange and Hermite interpolation used to construct a parametric cubic curve
segment
In order to make the construction of curves and surfaces easy and fast, another effective means is to
use approximation splines.
Approximation Splines

There are many methods that have been developed to produce approximation splines, e.g. Bézier
curves, B-splines (uniform, non-uniform or periodic), Beta-splines and NURBS (Non-Uniform,
Rational B-Splines) to name a few. We will now try to look at the most important of these in order
to give an introduction to them.

Bézier Curves
The first application of approximation splines is credited to the French mathematician Pierre Bézier
who worked for the Renault motor company. He proposed a method of drawing curves that would
provide an intuitive feel for automotive body designers, allowing shapes to be manipulated by
pulling out the curves. These curves interpolated end points, but approximated intermediate points.
This, it is argued, makes the curves easy to join together and simple to calculate as well as
manipulate. A Bézier curve for a simple cubic curve (degree 3) will have 4 control points as we
might expect, and might look like this:


                                                                 P3
                                  P1




                                             P2

             P0




Figure 2: Possible Bézier curves of degree 3

The most convenient equation used to describe a Bézier curve uses 'blending functions' which are
used to 'blend' the effect of the control points on each part of the curve. A Bézier curve then is
described by the following equation:




                                   where


                                  The equation of a Bezier curve
Perhaps the easiest way to understand how a curve might be constructed is to use the de Casteljau
construction of a Bezier curve. This is based on a physical analogy of points travelling in straight
lines along tracks.
Consider a simple quadratic curve with 3 control points as shown below:
                              P0

                                                      P1’

                       P0’’
            P0’
                                                                                  P0
       P0



 Figure 3: The de Casteljau construction
The curve generated from the above can be represented by the following set of linear equations
thus:
                                       P0’ = (1-t)P0 + tP1

                                             P1’ = (1-t)P1 + tP2

                                         P0’’ = (1-t)P0’ + tP1’

By substitution we get,

 S = P0’’ = (1-t)2 P0 + 2(1-t)t P1 + t2 P2

Thus the basis of the polynomial is not a power series, but a set of functions as follows:

                                                 (1-t)2
                                                 2(1-t)t
                                                   t2
 The basis function describes the blending of the point ‘attraction’ along the curve. We can plot
these to observe the effect that each control point has.

                          1




                          0
                              0                                           1


                                               B2,2         B1,2   B0,2




Figure 4: The Bernstein basis blending functions for a Bézier curve of degree 2
 As already mentioned the Bézier curve passes through its first and last control points. This
property derives from the Bernstein basis function since at the endpoints (t=0,1) the functions are
zero except for the first and last functions e.g. degree 3 – B0,3 and B3,3. At t=0 the curve is
tangential to the first segment of the control polygon, i.e. the line from control point 1 to control
point 2. Similarly at t=1 the curve is tangential to the last segment of the control polygon.
It is possible to create higher order Bézier curves to deal with more complex shapes, however, these
can become unwieldy and expensive to compute. Perhaps the greatest problem with this is that
small changes in the position of control points can make large deviations in the shape of the curve
and often not locally. Most CAD designers would not like this and prefer to be able to edit curves
using control points that exert local control only. One solution to this is to use many lower order
curves joined together and these are known as piecewise curve segments. Initially this is made
relatively easy since the first and last points are interpolated, however, the problem becomes
significant when we require smooth curve joins.

Continuity
The notion of continuity refers to the degree of smoothness between curve segments that are used
to make up a piecewise curve. Consider figure 5:




Figure 5: No continuity (the dots on the curves represent t between 0 and 1 in steps of 0.01)
If we wish to make 2 curves meet we can do so by ensuring that the last control point on the first
curve coincides with the first control point on the second curve, e.g. see figure 6:
Figure 6 G0, C0 continuity

The curves in figure 6 join but not smoothly. If these were train tracks a train could not get over
this join. Since the curves are tangential to their first and last control polygon segments we can
make the tangents on either side of the join equal by making the last two control points of the first
curve and the first two control points of the second curve lie along a common straight line, e.g. see
figure 7.




Figure 7 G1 continuity

Observing this plot we can see that we now have a smooth join between two curves. However if
we imagine that the curves describe the motion of an object, say a car, then although we can
imagine driving such a route we can also see that there would be an impossible step change in
speed as the route shape changes from curve 1 to curve 2. Thus the tangents at the curve ends have
the same direction but different magnitudes. These curves have geometric continuity (denoted as
G0, G1 etc), ie their geometric derivatives are equal. If we want to have continuity of both
direction and speed we have to ensure that the parametric derivatives are equal. See figure 8:




Figure 8 G1 and C1 continuity

Now not only do the 4 central control points lie along a line but the distances between the last 2
control points of the 1st curve and the first 2 control points of the 2nd curve are equal. These are
said to have parametric continuity (denoted by C1).
We can also define conditions for higher continuities for 2nd and 3rd derivatives to achieve, e.g. C2
and C3. E.g. see figure 9.




Figure 9 G2, C2 continuity

In general two curves have C or parametric continuity if the their parametric derivatives are equal
at the join whilst they have G or geometric continuity if their parametric derivatives are
proportional to each other. These examples illustrate continuity for 2D curves but the same
priciples apply to 3D curves and to surfaces.
Bézier curves also have a number of other useful properties. It can be seen from figure 4 that the
basis functions always sums to 1. This ensures that the curve is always contained within its convex
hull a fact useful for intersection computations and the like. Bézier curves are also said to be
affinely invariant with respect to their control points. This means that a Bézier curve is transformed
simply by transforming its control points. This means curves can simply spun or scaled e.g., simply
by spinning or scaling the control points. Another useful property is that the curve is variation
diminishing, indicating that the curve intersects any plane only as often as its control polygon.

B-Splines
B-splines consist of curve segments that have many similarities with single Bézier curves.
The major advantage of B-splines over Bézier curves is that we achieve continuity in piecewise
curves by sharing control points in the formulation. The number of points shared is dependent on
the degree of continuity required. This means that local changes to the curve are possible.
A B-spline curve can be defined in a similar way to a Bézier:




 where {Pi: =0,1,2….,n} are the control points, k is the order of the polynomial segments of the B-
spline curve and Bi,k are the normalised B-spline blending functions. The points where curves are
joined together are called 'knots' and to generate a B-spline we must specify a 'knot vector' which is
a list of the positions of these knots. These are usually normalised along the parameter space to give
values between 0 and 1 and may or may not be uniformly spaced. There are m – 1 knots in a curve
since the start and end points are considered as knots.

Where the knots are uniformly spaced the curve’s blending functions have equal weight.
We can set a cubic B-spline with any number of control points since we can link any number of
curve segments together and apply conditions for continuity between these. The algorithm for
generating the curve will then have to set the required number of curve segments and the continuity
between them. A cubic B-spline with C2 continuity then approximates a series of n+1 control
points where n = 3 and there are n - 2 curve segments.

Rational Splines
One drawback with Bézier curves and simple B-splines is that they cannot describe exactly conic
sections such as a parabola or circle. A means to overcome this is the use of rational parametric
curves. Rational curves are defined on the basis of homogeneous co-ordinates, which represent
three-dimensional points in terms of four dimensions with an additional w-axis co-ordinate. To
draw the curve in three-dimensional space the first three co-ordinates of each point are divided by
the fourth. This essentially uses one spline as the numerator and another as the denominator.



Non-Uniform Rational B-Splines (or NURBS)
Non uniform spacing allows the weight of the functions to vary in their ‘pull’ along the curve and
can therefore offer greater control. Where the curve is required to interpolate a particular point,
multiple control points can be placed at one position (for a cubic this is 3).
This approach can be used with Bézier curves but also with non-uniform B-splines to produce
NURBS.
This fourth dimension does come at some cost as calculations become larger and more draining on
computer resources. However most modern CAD systems do use NURBS, fortunately much of the
work is already done by these systems leaving the designer to think about the shape and as little as
possible about the maths.


Surfaces
The major advantage of parametric methods of representing curves is that they can be generalised
into surface representation. Both the Bézier curve and the B-Spline can be extended into 3D to
create surface patches.

Bézier Surface Patches
 If each point on a Bézier curve were moved along a curve of its own a Bézier Surface patch would
be traced out. The patches are defined by the network of points that form the control polyhedron.
Many of the properties of the patch are born from those belonging to the Bézier curve. The surface
approximates all of the points except the four corner points that are interpolated, they are tangent to
the start and end segments, contained within the convex hull of its control points and invariant
under affine transformations.

The general equation is obtained by extending the curve equation with another parametric variable,
normally u and v are used.

Bézier surface patches suffer the same problems as Bézier curves. The primary problem being that
the number of control points is directly related to the order and continuity.
Again it is preferable to create a surface using a series of patches. Also as with the curves the
continuity requirement prevents the ability to make local manipulations. For this reason B-Splines
(and particularly NURBS) form the basis of most modern surface modelling packages.

B-Spline Surface Patches
We move to B-Spline surfaces for the same reason as we moved from Bézier curves to B-Spline
Curves as again the surface properties are analogous to the curve properties. Importantly this gives
us a surface with which the continuity is independent of the number of control points and can be
locally manipulated. The rest of the useful B-Spline properties also remain in tact.


Rational Parametric Surfaces

These too are analogous to their curve roots and are defined by the equations of the Bézier or B-
spline surfaces written in homogeneous co-ordinates. This results in surface representation that is
capable of modelling spheres and cylinders as well as more abstract surfaces.

								
To top