Curves: Foundation of Free-Form Surfaces

You might also like

You are on page 1of 67

Curves

- Foundation of Free-form Surfaces


Why Not Simply Use a Point Matrix to
Represent a Curve?

Storage issue and limited resolution


Computation and transformation
Difficulties in calculating the intersections or curves
and physical properties of objects
Difficulties in design (e.g. control shapes of an
existing object)
Poor surface finish of manufactured parts
Advantages of Analytical
Representation for Geometric Entities

A few parameters to store


Designers know the effect of data points on curve
behavior, control, continuity, and curvature
Facilitate calculations of intersections, object
properties, etc.
Analytic Curves vs. Synthetic Curves

Analytic Curves are points, lines, arcs and circles,


fillets and chamfers, and conics (ellipses, parabolas,
and hyperbolas)

Synthetic curves include various types of splines


(cubic spline, B-spline, Beta-spline) and Bezier
curves.
Curved Surfaces
In CAD, We want to find a math form for representing curved
surfaces, that :
(a) look nice (smooth contours)
(b) is easy to manipulate and manufacture
(c) follows prescribed shape (airfoil design)

To study the curved surface, we need to start from curves.


Parametric Representation
* a curve * a surface

T T
P (u) = [ x(u), y(u), z(u)] P ( u , v ) =
x ( u , v ) , y ( u , v ) , z ( u , v )

u=const

Umax
--
p(x,y,z) n v=const

Umin --
p(u) y

We can represent any functions of curve (curved surface) using parametric equation.
Parametric Representation of Lines
How is a line equation converted by the CAD/
CAM software into the line database?
How are the mathematical equation correlated
to user commands to generate a line?

z P2-P1 P2, u=1


P1, u=0 P
P P = P1 + ( P - P1 )
P1 P2
P - P1 = u ( P2 - P1 )

y P = P1 + u( P2 - P1 ), 0 u 1
x
Lines
z P2-P1 P2, u=1
P
P1,
u=0
P P2
P1

y
P = P1 + u( P2 - P1 ), 0 u 1
x
x = x1 + u ( x2 x1 )

y = y1 + u ( y2 y1 ) 0 u 1
z = z + u ( z z )
1 2 1
Circle
Representation 1 (Non-parametric)

x2 + y2 = 1
(a) x=u

y= 1! u2

poor and non-uniform definition


square root complicated to compute 0 0.25 0.5 0.75 1
Circle
Representation 2 (parametric) /2 3/8
/4

(b) x = cos u /8
y = sin u
u
better definition than (a)
but still slow 0
Pn+1
Circle
Pn
Representation 3 (parametric)

(c) Recursive approach


x n = r cos
-- Pn
y n = r sin
x n +1 = r cos( + d ) = r cos cos d r sin sin d
x n +1 = x n cos d y n sin d
-- Pn+1
y n +1 = y n cos d + x n sin d

Observation: curves are represented by a series of line-segments


Similarly all conic sections can be represented.
Ellipse

x = xo + A cos

y = yo + B sin 0 2
z = z
o

The computer uses the same method as in the Representation


3 of circle to reduce the amount of calculation.
Example
Parabola

2
explicit x = cy

x = xo + Au 2
parametric
y = yo + 2 Au 0u
z = z
o
Hyperbola
2 2
x y
implicit
2
2 =1
a b

x = a cosh u

parametric y = b sinh u 0u
z = z
o
Parametric Representation of
Synthetic Curves
Analytic curves are usually not sufficient to meet geometric
design requirements of mechanical parts.
Many products need free-form, or synthetic curved
surfaces.
Examples: car bodies, ship hulls, airplane fuselage and
wings, propeller blades, shoe insoles, and bottles
The need for synthetic curves in design arises on
occasions:
when a curve is represented by a collection of measured
data points and (generation)
when a curve must change to meet new design
requirements. (modification)
The Order of Continuity
The order of continuity is a term usually used to measure
the degree of continuous derivatives (C0 , C1 , C2).

y y

i=2 i=2
i=1 i=1 i=3
i=3

x x

Simplest Case Linear Segment High order polynomial may lead to ripples

yi = ai 0 + ai1 x yi = ai 0 + ai1 x + ... + ain x n


Splines Ideal Order
Splines a mechanical beam with bending deflections, or a
smooth curve under multiple constraints.

(2) (3)
(1) (4)

y
x

'' M (x ) ai x + bi
y (x ) = R (x ) = =
EI EI
1 ai 3 bi 2
y (x ) = x + x + ci x + d i Cubic Spline
EI 6 2
Drafting Spline
Hermite Cubic Splines
T
P(u ) = [x(u ), y (u ), z (u )]
Cubic Spline
x(u ) = c3 xu 3 + c2 xu 2 + c1xu + c0 x x
3 2
34 = 12
y (u ) = c3y u + c2y u + c1 y u + c0 y y coefficients to
z (u ) = c u 3 + c u 2 + c u + c z be determined
3z 2z 1z 0z
!" T ! i
3
p u = !" x u y u
() () () () #
z u $ = % Ci u (0 & u & 1)
i=0
! C! #
' !3 (
' C ( !
! 3 2 #
= "u u u 1$ ' !2 T
( = [U ][C]
' C1 (
' ! (
'" C0 ($
Hermite Cubic Splines
i 3 2 1
3
P = Ci u = C3u + C2u + C1u + C0
i =0 !" , ! 2 ! !
P = 3C3u + 2C2u + C1

P0 = C0
u=0 '
Two P0 = C1 43 equations
End ! ! ! ! ! ! from two
Points # P1 = C3 + C2 + C1 + C0
u =1 " !' ! ! ! control points
#$ P1 = 3C3 + 2p0
C2 + C1
r
--
Boundary Conditions:
P0 '
Location of the two
u=1
end points and their u=0 r
p1
slopes r P
--1
r
P0
p0 P1 '
p1
-- --
Hermite Cubic Splines
! !
C0 = P0
! !'
C1 = P0 12 unknowns
! ! ! !' !' and
C2 = 3( P1 ! P0 ) ! 2 P0 ! P1 12 equations
! ! ! !' !'
C3 = 2( P0 ! P1 ) + P0 + P1
!" 3 # # 3 # 2 # 1 # All
P = ! Ci u = C3u + C2 u + C1u + C0
i parameters
can be
i=0 determined
3 2
3 2

P(u ) = (2u 3u + 1) P0 + (2u + 3u ) P1 Hermite

3 2
' 3 2
' Cubic curve
in vector
+ (u 2u + u ) P0 + (u u ) P1 form
Hermite Cubic Splines Equation:
! 3 2
! 3 2
!
P(u ) = (2u ! 3u + 1) P0 + (!2u + 3u ) P1 Hermite Cubic curve in
3 2
"' 3 2
!' vector form
+ (u ! 2u + u) P0 + (u ! u ) P1

! ! #
In matrix form: ! P0 Based on:
2 %2 1 1 # & ! '
& ' & P1 ' Location of
!u3 %3 3 %2 %1 '
" u2 u 1#$& & !' ' the two end
& 0 0 1 0 ' & P0 ' points and
&
" 1 0 0 0 '$ & !' ' their slopes
&" P1 '$

T
!
=U [M H ] V 0 ! u !1
' 2
2
2
'
P (u ) = (6u 6u ) P0 + (6u + 6u ) P1 + (3u 4u + 1) P0
2
'
+ (3u 2u ) P1 0 u 1
Limitations with Hermite Curves

Hard to guess behavior between 2 defined points for


arbitrary end point slopes

Limited to 3rd degree polynomial therefore the curve is


quite stiff
Bezier Curve
r r r
pp1
1
p
p22 p
p22
r
pp3
r 3
p3
p3 r
p
r p00
r
p
p00 p
p1
1
n
p (u ) = p B (u )
i i ,n
i =0

n segment(each polygon)
n+1 vertices (each polygon) and number of control points
u [0, 1]
Bezier Curve
P. Bezier of the French automobile company of
Renault first introduced the Bezier curve.
A system for designing sculptured surfaces of
automobile bodies (based on the Bezier curve)

- passes p 0 and p n , the two end points.


- has end point derivatives:
! ! ! ! ! !
p0 0= n( p11 p00 ); pn ' =pn(
'p ' = n( p ! p ) ' p ! pn
n =n n( pn!1
) pn1 )
- uses a vector of control points, representing the n+1 vertices of a
characteristic polygon.
Bernstein Polynomial

n! i n i
Bi ,n (u ) = u (1 u )
i!(n i ) !

Bi ,n (u ) is a function of the number of curve segments, n.

n=2
i 0 1 2
n! 2! 2! 2!
=1 =2 =1
i! (n i )! 0! 2! 1! 1! 2! 0!
Bernstein Polynomial

In the mathematical field of numerical analysis, a Bernstein polynomial,


named after Sergei Natanovich Bernstein, is a polynomial in the
Bernstein form, that is a linear combination of Bernstein basis
polynomials.
A numerically stable way to evaluate polynomials in Bernstein form is
de Casteljau's algorithm which reduces the computational demand
caused by the factorials.
--r
p
p11
An Example: If n = 2, r
-- --r
then n+1 = 3 vertices p
p00 p2
p2

i 0 1 2
n! 2! 2! 2!
=1 =2 =1
i! (n i )! 0! 2! 1! 1! 2! 0!

n
n! i n i
p(u ) = pi Bi ,n (u ) ( )
Bi ,n u = (
u 1 u )
i =0 i!(n i ) !
! 2 ! ! 2!
p(u) = 1! (1" u) p0 + 2 ! u(1! u) p1 +1! u p2
! ! ! !
p '(u) = !2(1! u) p0 + 2(1! 2u) p1 + 2up2
! ! r r r
p(0) = p0 p '(0) = 2( p1 p0 )
! ! r r r
p(1) = p2 p '(1) = 2( p2 p1 )
The order of Bezier curve is a function of the number of control points. Four
control points (n=3) always produce a cubic Bezier curve.

p1 p0 p3
p2
p2
p2 p3 p1 p1
p0
p0 p3

p3 p0

p1 p3 p2 p1
p2

p0
p1 p0 p3
p1 p2 p2
p1 p2

p1 p2 p1
pn,p3 pn,p3
Convex Hull Property
An Example
The coordinates of four control points relative to a current WCS are given by

T T T T
P0 = !" 2 2 0 #$ , P1 = !" 2 3 0 #$ , P2 = !" 3 3 0 #$ , P3 = !" 3 2 0 #$

Find the equation of the resulting Bezier curve. Also find points on curve for
u = 0, 1 , 1 , 3 ,1
4 2 4 P1 P2

P0 P3
Solution
P (u ) = P0 B0,3 + P1 B1,3 + P2 B2,3 + P3 B2,3 0 u 1

n! n i
Bi ,n (u ) = u i (1 u )
i!(n i ) !

2
P (u ) = P0 (1 u) + 3P1u (1 u ) + 3P2u 2 (1 u ) + Pu
3
3
3
0 u 1
Substituting the u values into his equation gives
T
P (0) = P0 = [2 2 0]
u = 0, , , , 1
1 27 27 9 1 T
P = P0 + P1 + P2 + P3 = [2.156 2.563 0]
4 64 64 64 64

1 1 3 3 1 T
P = P0 + P1 + P2 + P3 = [2.5 2.75 0]
2 8 8 8 8

3 1 9 27 27 T
P = P0 + P1 + P2 + P3 = [2.844 2.563 0]
4 64 64 64 64
T
P (1) = P3 = [3 2 0] P1(2,3) P2(3,3)

u=1/2

- control points, P1, P2, P3, & P4,


u=1/4 u=3/4
- points on curve, P(u)

P3(3,2)
P0(2,2)

Figure 5_49 Bezier curve and generated points


Improvements of Bezier Curve Over
the Cubic Spline
The shape of Bezier curve is controlled only by its defining
points (control points). First derivatives are not used in
the curve development as in the cubic spline.
The order or the degree of the Bezier curve is variable
and is related to the number of points defining it; n+1
points define a nth degree curve.
This is not the case for cubic splines where the degree is
always cubic for a spline segment.
The Bezier curve is smoother than the cubic splines
because it has higher-order derivatives.
B-Spline

A Generalization from Bezier Curve


Better local control
Degree of resulting curve is independent
to the number of control points.
Math Representation
n
P ( u ) = Pi N i ,k (u ) 0 u umax
i =0

(k-1) degree of polynomial with (n+1) control points


P0 , P1 , ... , Pn n+1 control points.

N i ,k ( u ) B-spline function (to be calculated in a recursive

form)

Ni ,k 1 (u ) Ni +1,k 1 (u)
Ni ,k (u) = (u ui ) + (ui + k u)
ui + k 1 ui ui + k ui +1
Parametric Knots
Ni ,k 1 (u ) Ni +1,k 1 (u)
Ni ,k (u) = (u ui ) + (ui + k u)
ui + k 1 ui ui + k ui +1

u j : parametric knots (or knot values), for an open curve B-spline:

0 j<k

u j = j k + 1 k jn
n k + 2 j>n

where, 0 j n+k, thus if a curve with (k-1) degree and
(n+1) control points is to be developed, (n+k+1) knots
then are required with 0 u umax = n k +2
k-1
Knot Value Calculation

Ni ,k 1 (u ) Ni +1,k 1 (u)
Ni ,k (u) = (u ui ) + (ui + k u)
ui + k 1 ui ui + k ui +1

n = 3; 4 control points n increases wider base


k = 4; 4-1=3 cubic polynomial k increases wider & taller
0 j n+k= 7
Properties of B-Spline
Number of control points independent of degree of
polynomial
vertex Quadratic B-Spline k=3
Linear k=2 Cubic B-Spline k=4
Fourth Order B-Spline k=5

vertex

The higher the order of


the B-Spline, the less the
vertex influence the close
control point

vertex n=3; 4 control points


Properties of B-Spline
B-spline allows better local control. Shape of the curve
can be adjusted by moving the control points.
Local control: a control point only influences k segments.

2
3
5
7

5
4

6
1
5
Properties of B-Spline
Repeated values of a control point can pull a B-spline
curve forward to vertex. ( Interactive curve control )

Add more
Same order repeated
polynomial control points
to pull the
curve
An Example

Find the equation of a cubic B-spline curve defined


by the same control points as in the last example.

How does the curve compare with the Bezier curve?


Example Problem for
Finding the Bezier Curve
Example Problem for Finding the Bezier Curve
Finding the B-Spline Curve for the Same Example Problem
Values to be Calculated

n = 3; 4 control points
n increases wider base
k = 4; 4-1=3 cubic polynomial
k increases wider & taller
uj: 0 j n+k= 7
Calculating the Knots, uj
1 ui u < ui +1

N i ,1 = 1 u = umax and u ui +1 and u ui = 1
Calculating Ni,1 0 otherwise

0
=0
0
Calculating Ni,k
Calculating Ni,k
Result

n + 1 control points: 3+1=4


k 1 degree curve: 4-1=3

4 control points cubic polynomial


Non-Uniform Rational
B-Spline Curve (NURBS)
Rational B-Spline
n
P ( u ) = Pi Ri ,k (u ) 0 u umax
i =0

hi N i ,k (u )
Ri ,k = n
(hi " scalar )
!h N i i ,k
(u )
i =0

If hi = 1, then Ri ,k (u ) = N i ,k (u ) ,it is the representation of a B-Spline curve.

Industry Standard Today!


h adds a degree of freedom to the curve, allowing to give more or less
weight to each control point

then
Development of NURBS

Boeing: Tiger System in 1979


SDRC: Geomod in 1993
University of Utah: Alpha-1 in 1981
Industry Standard: IGES, PHIGS, PDES,
Pro/E, etc.
Advantages of NURBS
Serve as a genuine generalizations of non-rational B-spline forms
as well as rational and non-rational Bezier curves and surfaces
Offer a common mathematical form for representing both standard
analytic shapes (conics, quadratics, surface of revolution, etc) and
free-from curves and surfaces precisely. B-splines can only
approximate conic curves.
Provide the flexibility to design a large variety of shapes by using
control points and weights. increasing the weights has the effect of
drawing a curve toward the control point.
Have a powerful tool kit (knot insertion/refinement/removal, degree
elevation, splitting, etc.
Invariant under scaling, rotation, translation, and projections.
Reasonably fast and computationally stable.
Clear geometric interpretations
Interpolation Using Hermite Curves
Clamped or Free Ends
Disadvantages of Cubic Splines

The order of the curve is always constant regardless


of the number of data points. In order to increase
the flexibility of the curve, more points must be
provided, thus creating more spline segments which
are still of cubic order.
The control of the curve is through the change of the
positions of data points or the end slope change.
The global control characteristics is not intuitive.

You might also like