0% found this document useful (0 votes)
17 views46 pages

Lecture 6 Spline

Uploaded by

Md Rony
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views46 pages

Lecture 6 Spline

Uploaded by

Md Rony
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 46

Computer Graphics

Lecture 06: Spline Representation

Masud Ibn Afjal


Associate Professor
Dept. of Computer Science and Engineering (CSE)
Hajee Mohammod Danesh Science and Technology University(HSTU), Dinajpur.
Spline representations
 A spline is a flexible strip used to produce a smooth curve through a designated
set of points.

 Several small weights are distributed along the length of the strip to hold it in
position on the drafting table as the curve is drawn.

 The term spline curve originally referred to a curve drawn


in this manner.

 Mathematically describe such a curve with a piecewise cubic


polynomial function whose first and second derivatives are
continuous across the various curve sections.
In Computer Graphics, -Splines
 Spline curve now refers to any composite curve formed with polynomial sections
satisfying specified continuity conditions at the boundary of the pieces.

 A spline surface can be described with two sets of orthogonal spline curves.

 There are several different kinds of spline specifications that are used in graphics
applications.

 Each individual specification simply refers to a particular type of polynomial with


certain specified boundary conditions.
Applications of Spline

1. Graphic applications to design curve and surface shapes.

2. To digitize drawings for computer storage.

3. To specify Animation paths for the objects for the camera in a scene.

4. Typical CAD applications for splines include the design automobile bodies.

5. Aircraft, Spacecraft surfaces & Ship hulls.


Interpolation & Approximation splines
 Spline curve by giving a set of coordinate positions, called control points
which indicates the general shape of the curve.

 Fitted with piecewise continuous parametric polynomial functions in


one of two ways.

 Interpolation spline

 Approximation spline
Interpolation

Polynomial sections are fitted so that the curve passes


through each control point, Resulting curve is said to
interpolate the set of control points.

 Interpolation curves are commonly used to digitize


drawings or to specify animation paths.
Approximation
The polynomials are fitted to the general control-point
path without necessarily passing through any control
point, the resulting curve is said to approximate the
set of control points.

 Approximation curves are primarily used as design


tools to structure object surfaces

 approximation spline surface created for a


design application. Straight lines connect
the control-point positions above the
surface.
Spline Curve
 A spline curve is defined, modified, and manipulated with operations on the
control points.

 By interactively selecting spatial positions for the control points, a designer


can set up an initial curve.

 Designer can then reposition some or all of the control points to restructure
the shape of the curve.

 The curve can be translated, rotated, or scaled with transformations


applied to the control points.

 CAD packages can also insert extra control points to aid a designer in
adjusting the curves shapes.
Convex hull
 Given a set of pins on a pinboard
 And a rubber band around them
 How does the rubber band look when it snaps tight?

 We represent the convex hull as the sequence of


points on the convex hull polygon, in counter-
clockwise order.
Convex hull Cont’d….
 The convex polygon boundary that encloses a set of control points is called
the convex hull.
 Convex hulls provide a measure for the deviation of a curve or surface from
the region bounding the control points.

 Some splines are bounded by the convex hull, thus ensuring that the
polynomials smoothly follow the control points without erratic
oscillations.

 The polygon region inside the convex hull is useful in some algorithms as a
clipping region.
Convex hull Cont’d….
Control graph
 A polyline connecting the sequence of control
points for an approximation spline is usually
displayed to remind a designer of the control-
point ordering.

 This set of connected line segments is often


referred to as the control graph of the curve.
Other names for the series of straight-line
sections connecting the control points in the
order specified are control polygon and
characteristic polygon.
An approximation splines surface for a CAD application in automotive
design
Parametric Continuity Conditions

• To ensure a smooth transition from one section of a piecewise parametric


curve to the next, we can impose various continuity conditions at the
connection points.
• If each section of a spline is described with a set of parametric coordinate

x=x(u) u 1 ≤ u ≤ u2
functions of the form

y=y(u)
z=z(u)
Parametric Continuity Conditions

We set the parametric continuity bt matching the parametric


derivatives of adjoining curve sections at their common
boundary.

1. Zero-order parametric continuity, ( described as C0


continuity), means simply that the curves meet. That is, the
values of x, y, and z evaluated at u, for the first curve section
are equal, respectively, to the values of x, y, and z evaluated
at u, for the next curve section.

Piecewise construction of a curve by joining two curve


segments using different orders of continuity:
(a)zero order continuity only,
(b) first-order continuity, and
(c)second-order continuity.
2. First-order parametric continuity,( C1 continuity) , means that the first parametric
derivatives (tangent lines) of the coordinate functions for two successive curve
sections are equal at their joining point.
du du du
dx dy dz

3. Second-order parametric continuity, or C2 continuity, means that both the first and
second parametric derivatives of the two curve sections are the same at the
intersection.
d 2u
dx
• With second-order continuity the rates of change of the
tangent vectors for connecting sections are equal at their
intersection.

• Thus, the tangent line transitions smoothly from one section


of the curve to the next

• But with first-order continuity, the rates of change of the


tangent vectors for the two sections can be quite different ,
so that the general shapes of the two adjacent sections can
change abruptly
Applications

1.First order continuity: digitizing drawings and some design applications

2.Second order continuity: setting up animation paths for camera motion


and for many precision CAD requirements
Geometric Continuity Conditions

• Alternate method for joining two successive curve sections.

• Require parametric derivatives of the two sections to be proportional to


each other at their common boundary instead of equal to each other
Geometric Continuity Conditions

1. Zero-order geometric continuity : (described as G0 continuity),is the same as zero-


order parametric continuity. That is, the two curves sections must have the same
coordinate position at the boundary point.

2. First-order geometric continuity, (or G1 continuity), means that the parametric first
derivatives are proportional at the intersection of two successive sections.

3. Second-order geometric continuity, or( G2 continuity) means that both the first and
second parametric derivatives of the two curve sections are proportional at their
boundary
Difference

• A curve generated with geometric continuity conditions is similar to one generated


with parametric continuity, but with slight differences in curve shape.
• With geometric continuity, the curve is pulled toward the section with the greater
tangent vector
Spline Specifications

There are three equivalent methods for specifying a particular spline representation
 We can state the set of boundary conditions that are imposed on the spline.
 we can state the matrix that characterizes the spline.
 we can state the set of blending functions (or basis functions) that determine how
specified geometric constraints on the curve are combined to calculate positions
along the curve path.
Spline Specifications-set of boundary conditions

To illustrate these three equivalent specifications, suppose we have the following


parametric cubic polynomial representation for the x coordinate along the path of a
spline section :

x(u ) a x u 3  bx u 2  c x u  d ....................(22.1) 0 u 1

• These four boundary conditions are sufficient to determine the values of the four
coefficients ax, bx, cx and dx by x(0), x(1), x’(0), x’(1).
Spline Specifications- the matrix

 ax 
b 
3
2
x(u )  u , u , u ,1 . x
 cx 
 u.c
 
 dx 
• where U is the row matrix of powers of parameter u, and C is the coefficient column matrix.

c M spline .M geom

• Where, Mgeom is a four-element column matrix containing the geometric constraint values (boundary
conditions) on the spline.

• Mspline is the 4-by-4 matrix that transforms the geometric constraint values to the polynomial
coefficients.
Spline Specifications- the Blending Function

• Finally, we can expand the eq. to obtain a polynomial representation for coordinate x
in terms of the geometric constraint parameters

3
x(u )  gk 0
k BFk (u )

• where gk are the constraint parameters, such as the control-point coordinates and
slope of the curve at the control points,
• BFk(u)are the polynomial blending functions.
Cubic spline interpolation methods

 Used to set up paths for object motions or to provide a representation for an existing object
or drawing.
 But interpolation splines are used to design object shapes.

 Cubic polynomials offer a reasonable compromise between flexibility and speed of


computation.
 Compared to higher-order polynomials, cubic splines require less calculations and memory
and they are more stable.
 Compared to lower-order polynomials, cubic splines are more flexible for modeling arbitrary
curve shapes
Cubic spline interpolation methods

• Given a set of control points, interpolation splines are obtained by fitting the input
points with a piecewise cubic polynomial curve that passes through every control
point.
• Suppose we have n + 1 control points specified with Coordinates:
pk ( xk , y k , z k ) k 0,1,2,...., n
• We can describe the parametric cubic polynomial that is to be fitted between each
pair of control points with the following set of equations:

x(u ) a x u 3  bx u 2  c x u  d x
3 2 0 u 1
y (u ) a y u  b y u  c y u  d y
z (u ) a z u 3  bz u 2  c z u  d z
Natural Cubic Splines

• This is a mathematical representation of the original drafting spline.


• This interpolation curve is a mathematical representation of the original drafting
spline.
• Two adjacent curve sections have the same first and second parametric derivatives at
their common boundary.
• Natural cubic splines have C2 continuity
Natural Cubic Splines

• If we have n + 1 control points to fit,

• then we have n curve sections with a total of 4n polynomial coefficients to be


determined

• At each of the n - 1 interior control points, we have four boundary conditions:

• The two curve sections on either side of a control point must have the same first and
second

• parametric derivatives at that control point, and each curve must pass through that
control point
Natural Cubic Splines

• We get an additional equation from the first control point p0, the position of the
beginning of the curve, and another condition from control point pn , which must be
the last point on the curve.
• We still need two more conditions to be able to determine values for all coefficients.
• One method for obtaining the two additional conditions is to set the second
derivatives at p0 and pn equal to 0.
• Another approach is to add two extra "dummy" control points, one at each end of
the original control-point sequence.
• That is, we add a control point p-I and a control point p n+1 ,
• Then all of the original control points are interior points,
• and we have the necessary 4n boundary conditions.
disadvantage

• If the position of any one control point is altered, the entire curve is affected.
• Thus, natural cubic splines allow for no "local control",
• so that we cannot restructure part of the curve without specifying an entirely new set
of control points.
Hermite Interpolation

• Named after the French mathematician Charles Hermite.


• It is an interpolating piecewise cubic polynomial with a specified tangent at
each control point.
• can be adjusted locally because each curve section is only dependent on its
endpoint constraints.
• If P(u) represent a parametric cubic point function for the curve section
between control point Pk , Pk+1. Boundary condition that define this Hermite
curve section are
P (0)  pk
P (1)  pk 1 with Dpk and Dpk+1 specifying the values for the
parametric derivatives (slope of the curve) at
P(0) Dpk control points pk and pk+1 respectively.
P(0) Dpk 1
Cardinal splines

• Cardinal splines are interpolating piecewise cubics with specified endpoint tangents at
the boundary of each curve section.

• The difference is that we do not have to give the values for the endpoint tangents

• For a cardinal spline, the value for the slope at a control point is calculated from the
coordinates of the two adjacent control points
Cardinal splines

• A cardinal spline section is completely specified with four consecutive control points.

• The middle two control points are the section endpoints, and the other two points are
used in the calculation of the endpoint slopes.

• Parameter t is called the tension parameter since it controls how loosely or tightly the
cardinal spline fits the input control points.

• When t = 0, this class of curves is referred to as Catmulll- rom splines, or Overhauser


splines
Bezier curves and surfaces

• Developed by the French engineer Pierre Bezier in 1960s for use in the design
of Renault automobile bodies curve and surface design.
• Easy to implement.
• For these reasons, Bezier splines are widely available in various CAD systems, in
general graphics packages (such as GL on Silicon Graphics systems), and in
assorted drawing and painting packages (such as Aldus Super paint and Cricket
Draw)
• Can be fitted to any number of control points
• The number of control points to be approximated and their relative
position determine the degree of the Bezier polynomial.
• Bezier curve can be specified with boundary conditions, with a
characterizing matrix, or with blending functions
Bezier Curves

• Suppose we are given n + 1 control-point positions: pk = (xk, yk, zk), with k


varying from 0 to n.
• These coordinate points can be blended to produce the following position
vector P(u), which describes the path of an approximating Bezier polynomial
function between p0, and p n .
Bezier Curves

• As a rule, a Bezier curve is a polynomial of degree one less than the number of control
points used
• Three points generate a parabola, four points a cubic curve, and so forth
• Bezier curves are commonly found in painting and drawing packages, as well as CAD
systems, since they are easy to implement and they are reasonably powerful in curve
design
Properties of Bezier Curves

• it always passes through the first and last control points


• the boundary conditions at the two ends of the curve are
P(0)=P0
P(1)=Pn
• Values of the parametric first derivatives of a Bezier curve at the
endpoints can be calculated from control-point cordinates as
P'(0) = -nP0 + nP1
P'(1) = - nPn-1 + nPn
Properties of Bezier Curves

• the slope at the beginning of the curve is along the line joining the first
two control points,
• and the slope at the end of the curve is along the line joining the last two
endpoints.
Properties of Bezier Curves

• Similarly, the parametric second derivative of a Bezier curve at the endpoints are calculated as
• Refer book
• it lies within the convex hull (convex polygon boundary) of the control points.
Design Techniques Using Bezier Curves

• Closed Bezier curves are generated by specifying the first and last control points at the same
position
• specifying multiple control points at a single coordinate position gives more weight to that position
Design Techniques Using Bezier Curves

• We can fit A Bezier curve to any number of control points, but this requires the calculation of
polynomial functions of higher degree
• When complicated curves are to be generated, they can be formed by piecing several Bezier
sections of lower degree together
• piecing together smaller sections also gives us better control over the shape of the curve in small
regions.
B-spline curves and surfaces

(1) the degree of a B-spline polynomial can


be set independently of the number of control points (with certain limitations),
(2) B-splines allow local control over the shape of a spline curve or surface
The trade-off is that &splines are more complex than Bezier splines.

You might also like