curves - engineeringmech410/old/2_lecture_notes/9_curves.pdf · 2009-03-02 · whyyy study curves?...
TRANSCRIPT
CurvesCurves- Foundation of Free-form Surfaces
Why Study Curves?y y• Curves are the basics for surfaces• When asked to modify a particular entity on a CAD
system, knowledge of the entities can increase your productivity
• Understand how the math presentation of various curve pentities relates to a user interface
• Understand what is impossible and which way can be more efficient when creating or modifying an entitymore efficient when creating or modifying an entity
Wh N t Si l U P i t M t i tWhy Not Simply Use a Point Matrix to Represent a Curve?
• Storage issue and limited resolutionC t ti d t f ti• Computation and transformation
• Difficulties in calculating the intersections or curves and physical properties of objectsp y p p j
• Difficulties in design (e.g. control shapes of an existing object)
• Poor surface finish of manufactured parts• Poor surface finish of manufactured parts
Advantages of Analytical Representation for Geometric EntitiesRepresentation for Geometric Entities
• A few parameters to store• 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 curvescurves.
Curved SurfacesCurved Surfaces
• In CAD We want to find a math form for representing curvedIn 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(b) is easy to manipulate and manufacture(c) follows prescribed shape (airfoil design)
To study the curved surface, we need to start from curves.
P t i R t tiParametric Representation* a curve * a surface a curve a surface
( ) ( ) ( ) ( )[ ]P u x u y u z uT
= , , ( ) ( ) ( ) ( ), , , , , ,T
P u v x u v y u v z u v= ⎡ ⎤⎣ ⎦
u=const
U
z
v=const Umax
Umin --
-- p(x,y,z) n
x
y U
p(u)
We can represent any functions of curve (curved surface) using parametric equation.
1( )C −
1( )C −
Surface fitting using discrete data2( )C −
P i R i f LiParametric Representation of Lines
• How is a line equation converted by the• How is a line equation converted by the CAD/CAM software into the line database?
• How are the mathematical equation correlatedHow are the mathematical equation correlated to user commands to generate a line?
1 1 ( - )= +P P P P
P2, u=1P1, u=0 P P2-P1
P2P1P
z
1 1- = ( - )u 2P P P P
( - ) 0 u 1u= + ≤ ≤P P P P
P2P1
y 1 2 1 ( ), 0 u 1u= + ≤ ≤P P P Px
y
LiLines
P P P2, u=1P1,u=0
P P2-P1
PP P
z
P2P1
1 2 1( - ) 0 u 1u= + ≤ ≤P P P Py
)( 121⎪⎧ −+= xxuxx
1 2 1 ( ), 0 u 1u+ ≤ ≤P P P Px
10)(
)(
121
121 ≤≤⎪⎩
⎪⎨
−+=−+= uzzuzzyyuyy
Ci lCircleRepresentation 1 (Non-parametric)
x y2 2 1+ =
Representation 1 (Non parametric)
(a) x = u (parameter)
21y u= −
• poor definition
• square root complicated to compute
0 0.25 0.5 0.75 1
Ci lCircle
Representation 2 3π/8π/2Representation 2
c o sx u
π/2π/4
(b) c o sx u=
s i ny u=
• better definition than (a)
π/8
u• better definition than (a)
• but still slow 0
Circle Pn+1Circle
Representation 3Pn
R e c u r s i v e a p p r o a c h
⎩⎨⎧
==
θθ
sincos
ryrx
n
n
θθθθθθ ddd ii)( +
-- Pn
θθθθθθ drdrdrx n sinsincoscos)cos(1 −=+=+
⎩⎨⎧
+=−=
+
+
θθθθ
dxdyydydxx
nnn
nnn
sincossincos
1
1 -- Pn+1⎩ + yy nnn 1
Observation: curves are represented by a series of line-segments
Similarly all conic sections can be represented.
ElliEllipse
πθθθ
20sincos
≤≤⎪⎨
⎧+=+= o
ByyAxx
πθθ 20 sin ≤≤⎪⎩
⎨=
+=
o
o
zzByy
The computer uses the same method as in the Representation 3 f i l d h f l l i3 of circle to reduce the amount of calculation.
P b lParabola
⎪⎧ += Auxx o
2
∞≤≤⎪⎩
⎪⎨
=+= u
zzAuyy o 0 2
⎩ = zz o
Parametric Representation of Synthetic Curves
• Analytic curves are usually not sufficient to meet geometric• Analytic curves are usually not sufficient to meet geometricdesign requirements of mechanical parts.
• Many products need free-form, or synthetic curvedsurfaces.
• Examples: car bodies, ship hulls, airplane fuselage andwings, propeller blades, shoe insoles, and bottleswings, propeller blades, shoe insoles, and bottles
• The need for synthetic curves in design arises onoccasions:
when a curve is represented by a collection of measuredwhen a curve is represented by a collection of measureddata points and (generation)when a curve must change to meet new design
i ( difi i )requirements. (modification)
The Order of ContinuityThe Order of ContinuityThe order of continuity is a term usually used to measure
y y
y ythe degree of continuous derivatives (C0 , C1 , C2).
y y
i=1i=2
i=1i=2
i=3
x x
i=1 i=3 i=1 i=3
Simplest Case Linear Segment High order polynomial may lead to “ripples”nxaay iii 10 += n
iniii xaxaay +++= ...10
Splines Ideal OrderSplines – Ideal OrderSplines ⎯ a mechanical beam with bending deflections, or a
h d l i l ismooth curve under multiple constraints.
(1)(2) (3)
(4)(1) (4)
x
y
x
( ) ( ) ( ) +=== ii bxaxMxRxy '' ( ) ( )
( ) ⎥⎤
⎢⎡ +++=
===
iiii dxcxbxaxy
EIEIxRxy
231 Cubic Spline( ) ⎥⎦⎢⎣+++ ii dxcxx
EIxy
26Cubic Spline
Hermite Cubic SplinesHermite Cubic Splines( ) ( ) ( ) ( )[ ]TuzuyuxuP ,,= Cubic Spline
( )( )⎪
⎨
⎧
+++=+++=
cucucucuycucucucux xxxx
2301
22
33 3×4 = 12
coefficients to ( )( )⎪
⎩
⎨+++=+++=
cucucucuzcucucucuy
zzzz
yyyy
012
23
3
0123
3
be determined
( ) ( ) ( ) ( ) ( )3
00 1
T ii
ip u x u y u z u Cu u
C=
= = ≤ ≤⎡ ⎤⎣ ⎦
⎡ ⎤
∑v
vur
3
3
2
1
2 [ ]1 [ ]Tu u u U
CC
CC
⎡
⎡ ⎤⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥
⎤ =⎣ ⎦=v
vv
1
0
CC⎢ ⎥⎢ ⎥⎦⎣v
Hermite Cubic Splines
01
12
2
3
0
33 CuCuCuCuCP
i
ii
vvvvv+++==∑
=, 2
ur v v v
⎨⎧ =
= 000CP
uvv
, 23 2 13 2P C u C u C= + +
4×3 equations from two
control points
⎩⎨
==
1'
0
0CP
u vv
1 3 2 1 01P C C C C
u⎧ = + + +⎨
v v v vvTwoEnd
Points
p0’ -- 'Pr
control points'1 3 2 1
13 2
uP C C C
= ⎨= + +⎩
v v vv
u=1 p1 u=0
0P
Pr
Boundary Conditions:Location of the two end points and their slopes
p0 -- p1’
0Pr
1 'Pr
1Pslopes
Hermite Cubic SplinesHermite Cubic Splines
PC =vv0
'0
' '
0
1
( )
P
P
C
C
=
=vv
v rv v v12 unknowns
and ' '1 0 0 1
' '0 1
2
0 13
3( ) 2
2( )
P P P P
P P P P
C
C
= − − −
= − + +v v v v v
12 equations
33 2 1
3 2 1 00
ii
iP C u C u C u C u C
=
= = + + +∑ur v v v v v
All 0i
'23'23
123
023
)()2(
)32()132()(
PP
PuuPuuuPvr
vvv+−++−=
parameters can be
determined
123
023 )()2( PuuPuuu −++−+
H it C bi S liHermite Cubic Splines
123
023 )32()132()( PuuPuuuP
vvv+−++−=
'1
23'0
23
10
)()2(
)()()(
PuuPuuuvr
−++−+
⎤⎡⎤⎡ − 1122 Pv Based on:
[ ]⎥⎥⎥⎥⎤
⎢⎢⎢⎢⎡
⎥⎥⎥⎥⎤
⎢⎢⎢⎢⎡
−−= '
0
1
0
23
010012331122
1PPP
uuu v
vased o
Location of the two end points and their slopes
⎥⎥⎦⎢
⎢⎣
⎥⎦
⎢⎣
'10001 Pv
[ ] 10 ≤≤= uVMU Tr
their slopes
[ ] 10 ≤≤= uVMU H
)143()66()66()( '0
21
20
2' +−++−+−= PuuPuuPuuuPvvvr
10 )23( '1
2 ≤≤−+ uPuuv
Joining C bic Spline Segments
(u=1) (u=0)
Joining Cubic Spline Segments
(u=0) (u=1) ( ) ( )
m m+1--Pm
, 1m mP +
r
Pr
Pr
' ' '1 11 1 1
'1 (1) , (1)(0) , ( ) ;0 m m m mm m P P PP P PP P + + + +== ==
r r r r r r r r
,1P 1mP +
1 , 1(1) (0) ;m m m mP P P+ += =r r r
2 curve segments & 24unknowns
' '1
'' ''
(1) (0);
(1) (0)m mP P
P P+=
=
r r
r r
unknowns
6 eqs. from first point, 6 eqs. from last point,
4 3 f j i i i t1(1) (0)m mP P += 4×3 eqs. from joining point
Go through center point, have same 1st and 2nd order derivatives
Joining Cubic Spline SegmentsJoining Cubic Spline Segments
' 2 2 2 ' 2 '( ) (6 6 ) ( 6 6 ) (3 4 1) (3 2 ) 0 1P u u u P u u P u u P u u P u+ + + + + ≤ ≤r v v v v
'1
'010
'' )26()46()612()612( PuPuPuPuPvvvvr
−+−++−+−=
0 1 0 1( ) (6 6 ) ( 6 6 ) (3 4 1) (3 2 ) 0 1P u u u P u u P u u P u u P u= − + − + + − + + − ≤ ≤
)0()1( 2''
1'' === uPuP
rr
'1
'0101
'' 4266)1( PPPPuPvvvvr
++−==
'''' 2466)0( PPPPuPvvvvr
+ 21212 2466)0( PPPPuP −−+−==
…
Q i C bi S liQuestions on Cubic Splines
• What are the control parameters to change the shape of a cubic spline?
• What if I want to change a local curvature?
• Is there any way I can increase the order of• Is there any way I can increase the order of continuity on a cubic spline?
• Can I improve the order of continuity by adding• Can I improve the order of continuity by adding more points?
Di d f C bi S liDisadvantages of Cubic Splines
• The order of the curve is always constant regardlessof the number of data points. In order to increasethe flexibility of the curve more points must bethe flexibility of the curve, more points must beprovided, thus creating more spline segments whichare still of cubic order.The control of the c r e is thro gh the change of the• The control of the curve is through the change of thepositions of data points or the end slope change.The global control characteristics is not intuitive.
Bezier CurveBezier Curve• P. Bezier of the French automobile company of
Renault first introduced the Bezier curveRenault first introduced the Bezier curve.
• A system for designing sculptured surfaces of automobile bodies (based on the Bezier curve)
- passes 0p and np , the two end points.
automobile bodies (based on the Bezier curve)
- has end point derivatives:
)();( '' == ppnpppnp0 1 0 1' ( ) ' ( )p n p p p n p p= − = −r r r r r r
)();( 1010 −−=−= nnn ppnpppnp
- uses a vector of control points, representing the n+1 vertices of a
“characteristic polygon”.
0 1 0 1( ) ( )n n np n p p p n p p −
M h E iMath Expression
pr pr rp1 p2
p3
p2 p3
1p
3pr
2p2p
3pr
pr
p0
p3p0
p1 0pr3p
0p
1pr
( ) ( )uBpup ni
n
ii ,
0∑=
=
n — segment(each polygon)g ( p yg )
n+1 — vertices (each polygon) and number of control points
[ ]1,0∈u
B i P l i lBernstein Polynomial
( ) ( ) ini uunuB −= 1!( ) ( ) ( )ni uuini
uB −−
= 1!!,
)(, uB ni is a function of the number of curve segments, n, and i.
i 0 1 2i 0 1 2
( )!!!
inin−
1!2!0
!2= 2
!1!1!2
= 1!0!2
!2=
An Example: If n = 2,
-- p1 1pr
i 0 1 2
p ,then n+1 = 3 vertices
--p2
--p0 0pr 2pr
!
( )!!!
inin−
1!2!0
!2= 2
!1!1!2
= 1!0!2
!2=
n
( ) ( ) ( ) inini uu
ininuB −−−
= 1!!
!,( ) ( )uBpup ni
n
ii ,
0∑=
=
0 1 22 2( ) (1 ) (1 )
'( ) 2(1 )1
2(1 2 ) 22 1p p pp u u u u u= × − + × − + ×
r
r r r r
rr r
0 1 2
0
'( ) 2(1 ) 2(1 2 ) 2(0)(1)
p u u p u p upp pp p
= − − + − +=
r r
r r1 0'(0) 2( )
'(1) 2( )p p pp p p
= −
=
r r r
r r r2(1)p p= 2 1(1) 2( )p p p= −
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 p2 p0 p3
p0
p2
p3 p1
p2 p2 p1
p0
p1
p3 p0
p3
p2p1 p2
p0 p1
p2p3
p0
p1
p1 p0 p2
p3 p1 p2
p1 p2
pn,p3 p1 p2 p1 pn,p3
A E lAn Example The coordinates of four control points relative to a current WCS are given byp g y
[ ] [ ] [ ] [ ]TTTT PPPP 023,&033,032,022 3210 ====
Find the equation of the resulting Bezier curve. Also find points on curve forq g p
1,&43,2
1,41,0=u
P2P1 21
y ?
P0P3x
S l tiSolution
( ) 10 ≤≤+++= BPBPBPBPP
( ) ( ) in!
( ) 103,233,223,113,00 ≤≤+++= uBPBPBPBPuP
( ) ( ) ( ) inini uu
ininuB −−−
= 1!!
!,
e.g.
( ) ( ) ( )23 2 3(1 ) 3 1 3 1 0 1P u u u u u uP P P Pu u+ + + ≤ ≤( ) ( ) ( )0 1 2 3(1 ) 3 1 3 1 0 1P u u u u u uP P P Pu u= − + − + − + ≤ ≤
Substituting the u values into his equation gives
[ ]TPP 022)0( 0 ==
[ ]TPPPPP 0563.2156.219272713210 =+++=⎟
⎞⎜⎛
u = 0, ¼, ½, ¾, 1[ ]PPPPP 0563.2156.2
646464644 3210 +++⎟⎠
⎜⎝
[ ]TPPPPP 075.25.281
83
83
81
21
3210 =+++=⎟⎠⎞
⎜⎝⎛
8888⎠⎝
[ ]TPPPPP 0563.2844.26427
6427
649
641
43
3210 =+++=⎟⎠⎞
⎜⎝⎛
( ) [ ]TPP 0231 3 == P1(2,3) P2(3,3)
u=1/2
u=1/4 u=3/4 - control points, P1, P2, P3, & P4,
points on curve P( )
P0(2,2) P3(3,2)
- points on curve, P(u)
Improvements of Bezier Curve OverImprovements 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 splineused 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+1a d s e a ed o e u be o po s de g ;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 derivativesbecause it has higher-order derivatives.
B S liB-Spline
• A Generalization from Bezier Curve
• Better local control• Better local control
• Degree of resulting curve is independentt th b f t l i tto the number of control points.
M h R iMath Representation
( ) , max0
( ) 0i
i k
n
iP u N u uP u=
= × ≤ ≤∑
⎯ nPPP ,...,, 10 ⎯⎯ n+1 control points.
(k-1) degree of polynomial with (n+1) control points
⎯ )(, uN ki ⎯⎯ B-spline function (to be calculated in a recursive
form)
1 1
, 1 1, 1,
( ) ( )( ) ( ) ( )i i k
i k
i k i ki k
i i k i
u uu uN u N u
Nu
uu
u u−+
+ − +
+
+
−= − + −− −1 1i k i i k i+ + +
Parametric KnotsParametric Knots
, 1 1, 1( ) ( )( ) ( ) ( )i k i kN u N u
N − + −
:u parametric knots (or knot values) for an open curve B spline:
1 1
, 1 1, 1,
( ) ( )( ) ( ) ( )i i k
i k
i k i ki k
i i k i
u uu u
Nu
uu
u u++ − +
+
+
= − + −− −
:ju parametric knots (or knot values), for an open curve B-spline:
0 j k<⎧⎪ 1
2j j k k j n
n k j nu ⎪= − + ≤ ≤⎨
⎪ − + >⎩
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
≤≤( ) p p , ( )then are required with 0 u umax = n – k +2≤≤
Knot Value Calculation
, 1 1, 1( ) ( )( ) ( ) ( )i i k
i k i ki k u u
N u N uN uu u−
++ −= − + −
1 1, ( ) ( ) ( )i i k
i ki k
i i k i
u uu u
Nu
uu
u u++ − + +
+− −
n = 3; 4 control points i id bn 3; 4 control pointsk = 4; 4-1=3 cubic polynomial
0 ≤ j ≤ n+k= 7
n increases – wider basek increases – wider & taller
C l l i f F i( )NCalculation of Functionn
∑
, ( )i kN u
( ) , max0
( ) 0i i ki
P u P N u u u=
= × ≤ ≤∑111 )()( kiki uNuN
1
1,1
1
1,,
)()(
)()()(
++
−++
−+
−
−−+
−−=
iki
kiki
iki
kiiki uu
uNuu
uuuN
uuuN
1 ≤ <⎧
a 1,1
1
m x
11 10
i i
i ii
u u uN u u and u u and u u
otherwise
+
+
≤ <⎧⎪= = ≤ − =⎨⎪⎩0
0
otherwise⎪⎩
0 00=
Role of B-Spline Functionp(Calculating Weights from Nearby Control Points)
1
, ( )i kN u
, ( )i kN u , ( )i kN u
Linear k=2
Quadratic 1
10.75
0.5
k=3
0 5
1 2 0 0 1 2 3 4
u u
0 1 2 3 40 1 2
0.5
2/3
, ( )i kN u
Cubic k=4
2/3
1/6
1 2 3 4
u
0 1 2 3 4
P ti f B S liProperties of B-Spline• Number of control points independent of degree of
polynomial
Quadratic B-Spline k=3vertex Cubic B-Spline
Fourth Order B-Splinek=4
k=5Linear k=2 x
vertex
vertex
The higher the order of the B-Spline, the less the
influence the close control pointcontrol point
n=3; 4 control pointsvertex
Properties of B-Splinep p
• 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
75’’’
7
4
6
5’’
1 5
6
Properties of B-Splinep p
Repeated values of a control point can pull a B-spline curve forward to vertex. (“Interactive curve control”)
Add more repeated
control pointsSame order polynomial control points
to pull the curve
polynomial
Bezier CurveDifferent order
polynomial
A E lAn Example
Find the equation of a cubic Bcubic B--spline curvespline 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 Curveg
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 i id b; pk = 4; 4-1=3 cubic polynomial
uj: 0 ≤ j ≤ n+k= 7
n increases – wider basek increases – wider & taller
Calculating the Knots, uj
111
1max
1
1,⎪⎨
⎧=−≤=
<≤= +
+
uuanduuanduuuuu
N ii
ii
i
Calculating Ni,1
0
01max1,
⎪⎩
⎨ +
otherwiseiii
000=
Calculating Ni,k
Calculating Ni,k
Result
+ 1 t l i t 3+1 4n + 1 control points: 3+1=4k – 1 degree curve: 4-1=3
4 control points – cubic polynomial
Non-uniform RationalNon uniform Rational B-Spline Curve (NURBS)i l li
( ) max( ) 0n
ki iP u u u uRP= × ≤ ≤∑
Rational B-Spline
( ) , max0
( )ki
i i=∑
, ( )( )i i k
i k i
h N uR h scalar= −,
,0
( )( )
i k in
i i ki
R h scalarh N u
=∑
If )()(th1 NRh it i th t ti f B S liIf )()( then ,1 ,, uNuRh kikii == ,it is the representation of a B-Spline curve.
Industry Standard Today!
Development of NURBS
• Boeing: Tiger System in 1979
• SDRC: Geomod in 1993
• University of Utah: Alpha-1 in 1981y p
• Industry Standard: IGES, PHIGS, PDES, Pro/E etcPro/E, etc.
Advantages of NURBSg• 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) andfree-from curves and surfaces precisely B-splines can onlyfree-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 eights increasing the eights has the effect ofcontrol 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.Reasonably fast and computationally stable.• Clear geometric interpretations
Quick Questionsn + 1 – number of control points; & k – degree of the curve (polynomial)
Quick Questions
• For B-spline, k should always be less than or equal to n+1. T or F? why?
• What are the two major advantages of B-spline over Bezier curve in j g preal design?
• If k increases in its reasonable range, will the corresponding B-spline curve move closer to the control polygon.?p yg
• What are the required user inputs to construct a Hermite Cubic, Bezier, B-spline and NURBS curve segment?
• By adding more control points in a small region when defining aBy adding more control points in a small region when defining a Bezier curve, one can manipulate the curvature of the curve without affecting other curve sections. T or F.?
• B-spline curves are identical to Bezier curves when k=n+1 T or F?B spline curves are identical to Bezier curves when k n+1. T. or F?