You are on page 1of 77

Modelling of Synthetic Curves

Dr P. RAVINDER REDDY
Professor
Dept. of Mechanical Engineering,
Chaitanya Bharathi Institute of Technology
Hyderabad-500 075,AP
Email: ravinderreddyp_mech@cbit.ac.in
UNIT – II
Modelling of Curves:
❖Properties of splines
❖Synthetic curves :
• Cubic Curve
• Bezier Curve
• B-Splines Curve
• Non Uniform Rational B-Splines
Modelling of Curves
Design of curved shapes should satisfy the
following requirements
1. It should be possible to represent the shape
mathematically.
2. The modeling should involve minimum
computation.
3. It should be possible to generate a CNC
program to machine the surface (2, 3, 4 and 5
axis machining) or to prepare a mould or die to
make the part (as in plastic molding or casting
or automobile panel pressing)
Properties of a spline curve
1. Control points (knots, interpolation, and
extrapolation): A common way to control the
shape of a curve interactively is to locate points
through which the curve must pass or points
that control the curve’s shape in a predictable
way. These points are called control points. or
sometimes knots when they lie on the curve
itself. A curve is said to interpolate the control
points if it passes through them.
2. Multiple values: A curve is not a graph of single
valued function coordinate, irrespective of the
choice of coordinate system (See Fig.1).
Figure 1: A curve can be multivalued with respect to all coordinate system.

3. Axis independence: Shape of an object will not


change when the control points are measured
in different coordinate system. If, for example,
the control points are rotated 90 degrees, the
curve should rotate 90 degrees but not change
shape. Some mathematical formulations will
cause a curve’s shape to change if the
reference coordinate system is changed.
4. Global or local control: As a designer manipulates
a control point, a curve may change shape only in
the region near the control point, or it may change
shape throughout (Figure 2). This last behavior,
called global control, may be annoying to the
designer trying to make to fine adjustments to just
one portion of the curve.

Fig.2: Curve shapes are modified


by moving control points. Curves
having local control (a) change
shape only near an altered control
point; those with global control (b)
change shape throughout
5. Variation-diminishing property: Some
mathematical representations have an annoying
tendency to amplify. Rather than smooth, any
small irregularities in the shape outlined by control
points (Figure 3a). Others, possessing variation-
diminishing property, always smooth the designer’s
control points. Figure 3b shows a sequence of knot
points and an associated variation-diminishing
curve. This curve will never cross an arbitrarily
chosen straight line more often than a sequence of
lines that connect the knot points (dashed line).
Fig.3: (a) A curve that oscillates about its control points is usually
undesirable. (b) Variation-diminishing curves tend to smooth out a
sequence of control point.
6. Versatility: A curve representation that allows
only a limited variety of shapes may frustrate a
designer. A framework that provides only arcs of
circles, for example, lacks sufficient versatility to
model most designs. More flexible techniques
allow the designer to control the versatility of a
curve representation, often by adding or removing
control points. For example, a curve specified by
two control points might be a straight line
connecting the points; introducing a third control
point allows the curve to take on a large number
of additional shapes, depending on the location of
the control point.
7. Order of continuity : A complex shape is usually not
modeled by a single curve, but by several pieced
together end-to-end.
Such joints are used to introduce sharp corners which
might be difficult to represent within a curve
framework.
In other cases, a joint is introduced to increase
versatility: a shape that cannot be described by a
single curve can often be described by several curves
joined together.
When creating joints, the designer often wants to
control the order of continuity at the joint (Figure 4).
Zero-order continuity means simply that two curves
meet; first-order continuity requires the curves to be
tangent at the point of intersection; second-order
continuity requires that curvatures be the same.
Fig.4: Orders of continuity at joints: (a) zero-order continuity; (b) first-order continuity (slope);
(c) second-order continuity (curvature)
Limitations of Non-Parametric Curves:
1. If the slope of a curve at a point is vertical or near vertical, its
value becomes infinity or very large, a difficult condition to
deal with both computationally and programming wise. Other
ill – defined mathematical conditions may result.
2. Shapes of most engineering objects are intrinsically
independent of any coordinate system, what determines the
shape of an object is the relationship between its data points
themselves and not between these points and some ordinary
coordinate system.
3. If the curve is to be displayed as services of points or straight-
line segments, the computations involved could be expensive.
Parametric farm a curve is given by

Hermite Cubic Spline:


Hermite curve is a cubic polynomial and named after the
French mathematician Charles Hermite. Hermite curve is
passing throgh the end points and tangent at these end
points. Cubic spline is interpolating piecewise cubic
polynomial with a specified tangent at each control point.
Hermite splines adjust locally because each curve section is
only dependent on its end point constraints.
Where u is the parameter and Ci are the polynomial (also
called algebraic) coefficients. In scalar form this equation
is written as

(2)

In an expanded vector form, Eq.(1) can be written as


This equation can also be written in a matrix form as

Where U = [u3 u2 u 1]T and C = [C3 C2 C1 C0]T. C is called coefficients vector

The tangent vector to the curve at any point is given by differentiating


the equation (1) with respect to u to give

In order to find the coefficients Ci, consider the cubic spline curve with
the two endpoints P0 and P1 shown in Fig.1. Applying the boundary
conditions (P0, P0’ at u=0, and P1, P’1 at u=1), Eqs. (1) and (5) give
P0 = C0
P’0 = C1
P1 = C3 + C2 + C1 + C0 (6)

Solving these four equations


simultaneously for the coefficients
gives

Fig.1: Hermite Cubic Spline curve


P0, P1, and are called geometric coefficients. The tangent vector becomes

The function of u in Eqs.(8) and (9) are called blending Functions( or Hermite
functions or Weighting functions). The first two functions blend P0, P1, and the
second two blend and . Equation (8) can be written in a matrix form as

Where [MH] is the Hermite matrix and V is the geometry (or boundary conditions)
matrix. Both are given by

(11)
Comparing Eq.(4) and (10) shows that or

Where

(13)

Similarly Eq.(9) can be written as

is given by
(15)
Equation (8) describes the Hermite cubic spline curve in
terms of its two end points and their tangent vectors.
1. The equation shows that the curve passes through the
end points (u=0 and 1).
2. It also shows that the curves shape can be controlled by
changing its end points or its tangent vectors.
3. If the two end points P0 and P1 are fixed in space, the
designer can control the shape of the spline by changing
either the magnitudes or the directions of the tangent
vectors P’0 and P’1
➢For planar splines, tangent vectors can be replaced
by slopes.
➢In this case, a default value, such as 1, for the
lengths of the tangent vectors might be assumed
by the software to enable using Eq.(8).
➢For example, if the slope at P0 is given as 30
degrees, then P’0 becomes [cos30 sin30 0].
➢It is obvious that the slope angle and the
components of P’0 are given relative to the axes of
the WCS that is active when the spline segment is
created.
• Equation(8) is for one cubic spline segment. It can
be generalized for any two adjacent spline
segments of a spline curve that is to fit a given
number of points.
• This introduces the problem of blending or
joining cubic spline segments, which can be
stated as follows:
• Given a set of n points, P0,P1,....,Pn-1 and two end
tangent vectors P’0 and P’1, connect the points
with cubic spline curve.
• The spline curve is created as a blend of spline
segments connecting the set of points starting
from P0 and ending at Pn-1.
• The use of cubic splines in design applications is
not very popular due to the need for tangent
vectors or slopes to define the curve.
• Also, the control of the curve is not very obvious
from the input data due to its global control
characteristics.
• For example, changing the position of a data point
or an end slope changes the entire shape of the
spline, which does not provide the intuitive feel
required for design.
Fig.2: Shows the control aspects of Hermite cubic spline curve
Now equation(8) can be written as

Where H0,H1,H2,H3 are blending or Hermite functions


Fig.3: Variation of Hermite functions against parameter u
Solution: The two end tangent vectors of the spline
are the lines shown. Thus
and

The two end points are P0 and P2. Substituting into Eq.(8) gives
Bezier Curves
For a Cubic Bezier Curve
• A Bezier curve is blended at the joints and is completely defined
by four consecutive points P0(x0, y0), P1(x1, y1), P2(x2, y2) and P3(x3,
y3).
• The curve passes through the first and fourth point. The two
intermediate points are used to define the slope of the curve at
the end points.
• If x0, x1, x2 and x3 are x-coordinates of the control points, it is
assumed that

The curve passes through the points x0 and x3

The slopes at the points are


and the parametric second derivatives are
Bezier Curve in Parametric form

Where Pi is a control point= [xi yi zi]T

= Bernstein polynomials or Blending function

=Binomial Coefficient
Characteristics of Bezier Curve
1. The curve interpolates the first and last control
points, that is it passes through P0 and Pn if u=0
and u=1
P(0)= P0, P(1)= Pn
2. The curve is tangent to the first and last segments
of the characteristic polygon.
The rth derivative at the end points is
3. The curve is symmetric with respect to u and (1-u).
This means that the sequence of control points
defining the curve can be reversed without change
of the curve shape; i.e reversing the direction of
parameterization does not change the curve shape.
4. The interpolation polynomial has a max value of
c(n, i) (1-i/n)n-i occurring at u = i/n which can be
obtained from the eqn.d /du=0. This implies that
each control point is most influential on the curve
shape at u= i/n. Ex. For Cubic Bezier curve P0, P1, P2
and P3 are most influential when u=0 ,1/3,2/3 and 1.
Therefore each control point is weighted by its
blending function for each u value.
5. The curve shape can be modified either changing one
or more vertices of its polygon or by keeping the
polygon fixed and specifying multiple coincident
points at a vertex.
6. A closed Bezier curve can simply be generated by
closing its characteristic polygon or choosing P0 and Pn
to be coincident.
7. 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.
Since Bezier curves pass through end points, it is easy
to match curve sections (Zero order continuity).

Bezier curves have the important property that the


tangent to the curve at an end point is along the line
joining that endpoint to the adjacent control point.
To obtain first-order continuity between curve
sections, we can pick control points and of new
section to be along the same straight line as control
points Pn and Pn-1 of the previous section. When the
two Curve sections have the same number of control
points, we obtain continuity by choosing the first
control points of the new section as the last control
point of the previous section and by positioning the
second control point of the new section at position

thus the control points are collinear and equally


spaced
Fig.1 Piecewise approximation Curve formed with two Bezier section.
Zero-order and first-order continuity are attained between Curve
sections by setting = and by making points , , and
collinear.

We obtain C2 continuity between two Bezier sections by calculating the


position of the third control point of new section in terms of the
positions of the last three control points of the previous section as
Fig2: The four Bezier blending functions for n = 3.
For a Cubic Bezier Curve, n+1=4, hence n=3, then Parametric
curve becomes
Prob1: Construct a Bezier curve for the ‘4’ sample points
P0(1, 1), P1(2, 3), P2(4, 3), P3(3, 1).
Solution:
P2
Substituting the u values into the above equation gives
B-Spline Curve
(6.91)

Partition of unity:

1
(6.92)

where
(6.93)
- -

<
≤ ≤ (6.94)
>

≤ ≤ (6.95)

And the range of u is

(6.96)
-

> (6.97)

-
- -
-
-

( ) ( ) ( ))

≤ ≤

< ≤

≤ ≤

<

/ >
≤ ≤
( ) ≤ ≤

, , ,

≤ ≤
,

, , ,

, , , ( ) ,
, ( ) ( )

, , , ( ) ,
, ( ) ( )

, , , ( ) ,
( ) ( ) ( ) ,
,
, , ( ) ,
, ( ) ( ) , ,

, , , ( ) ,
, ( ) ( ) ( )
, , ( ) , ( ) ,
, ( ) ( )

, ,
, ( ) ( ) ( )

, , , ( ) ,
, ( ) ( ) ( ) ( ) ,

, ,
, ( ) ( ) , ( ) , ( ) ,

, , ,
, ( ) ( ) , ( ) ,

, , , ,
, ( ) ( ) ( ) ( )

, ,
, ( ) ( ) ( ) ,

, ,
, ( ) ( ) ( ) ,

, ,
, ( ) ( ) ( ) ,

, ,
, ( ) ( ) ,
( ) ( ) ( ) ( ) , ≤ ≤

( ) ( ) ( ) ( ) ≤ ≤

≤ ≤
( ) , , , , ≤ ≤

, ( ) , (( ) )
, ( ) , (( ) )

, ( ) , (( ) )
, ( ) , (( ) )

( ) , (( ) ) , (( ) )
, (( ) ) , (( ) ) ≤ ≤
≤ ≤
,

≤ ≤
,

≤ ≤
,

≤ ≤
,

, ,
, ( ) ( ) , ( ) ,

, ,
, ( ) ( ) ( ) , ( ) ,
, ,
, ( ) ( ) ( ) , ( ) ,

, ,
, ( ) ( ) , ( ) ,

, ( ( ) ( )( )) , ( ) ,

, ,
, ( ) ( ) ( ) , ( ) ,

( ) , (( )( ) ( )( )) , ( ) ,

, ( ) ( ) , ( ) ,

( ) , ( ( ) ( )( ) ( )( ) ) .,

( ( ) ( )( )( ) ( ) ( )) , ( ) ,
, [ , (- ) , ( ) ,

(- ) , ]

≤ ≤

≤ ≤

≤ ≤

≤ ≤
( ) , ( ) , ( )

+ , ( ) , ( )

, ( ) , ( ) , ( ) , ( )

( ) , ( ) , ( ) , ( ) , ( )

( ) , ( ) , ( ) , ( ) , ( )

( ) , ( ) , ( ) ,( ) , ( )

( ) , ( ) , ( ) , ( ) , ( )
( ) , ( ) , ( ) , ( ) , ( )
Prob.3: Construct a B-Spline curve of 2nd order with 4 Polygon
vertices P0(1, 1), P1(2, 3), P2(4, 3), P3(3, 1).

Solution: n+1=4, n=3, k=2, umax=n-k+2=3-2+2=3

The knot vector set for a second order curve defined by four
polygon vertices is
( ) ≤ ≤

, , ,

≤ ≤
,

, , ,

, , , ( ) ,
, ( ) ( )

, , , ( ) ,
, ( ) ( )

, , , ( ) ,
( ) ( ) ( ) ,
,
, , ( ) ,
, ( ) ( ) , ,

, , , ( ) ,
, ( ) ( ) ( )
, , ( ) , ( ) ,
, ( ) ( )

, ,
, ( ) ( ) ( )

, , , ( ) ,
, ( ) ( ) ( ) ( ) ,

, ,
, ( ) ( ) , ( ) , ( ) ,

, , ,
, ( ) ( ) , ( ) ,

, , , ,
, ( ) ( ) ( ) ( )

, ,
, ( ) ( ) ( ) ,

, ,
, ( ) ( ) ( ) ,

, ,
, ( ) ( ) ( ) ,

, ,
, ( ) ( ) ,

You might also like