Curves - Engineering · 2009-03-02 · 3/2/2009 1 Curves-Foundation of Free-form SurfacesWhy Study...
Transcript of Curves - Engineering · 2009-03-02 · 3/2/2009 1 Curves-Foundation of Free-form SurfacesWhy Study...
3/2/2009
1
Curves- Foundation of Free-form Surfaces
Why Study Curves?• 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 entities relates to a user interface
• Understand what is impossible and which way can be more efficient when creating or modifying an entity
3/2/2009
2
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)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.
3/2/2009
3
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(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 :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.
3/2/2009
4
Parametric Representation* 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
v=const Umax
z
-- p(x,y,z) n
x
y Umin --
p(u)
We can represent any functions of curve (curved surface) using parametric equation.
1( )C −( )
1( )C −
Surface fitting using discrete data2( )C −
3/2/2009
5
Parametric Representation of Lines
• How is a line equation converted by the CAD/CAM ft i t th li d t b ?CAD/CAM software into the line database?
• How are the mathematical equation correlated to user commands to generate a line?
P2, u=1P1, u=0 P P2-P1z
1 1
1 1
( - )- = ( - )u= +
2
P P P PP P P P
1 2 1 ( - ), 0 u 1u= + ≤ ≤P P P P
P2P1P
x
y
Lines
P2, u=1P P P2-P1z2P1,
u=0P2P1
P
)(⎧ + xxuxx
1 2 1 ( - ), 0 u 1u= + ≤ ≤P P P Px
y
10)()()(
121
121
121
≤≤⎪⎩
⎪⎨
⎧
−+=−+=−+=
uzzuzzyyuyyxxuxx
3/2/2009
6
CircleRepresentation 1 (Non-parametric)
x y2 2 1+ = (a) x = u (parameter)
21y u= −
• poor definition
• square root complicated to compute
0 0.25 0.5 0.75 1
Circle
Representation 2 3π/8π/2π/4
(b) c o sx u=
s i ny u=
• better definition than (a)
• but still slow
π/8
π/4
0u
3/2/2009
7
Circle
Representation 3Pn
Pn+1
R e c u r s i v e a p p r o a c h
⎩⎨⎧
==
θθ
sincos
ryrx
n
n
θθθθθθ drdrdrx n sinsincoscos)cos(1 −=+=+
⎨⎧ −=+ θθ dydxx nnn sincos1 P
-- Pn
⎩⎨ +=+
+
θθ dxdyy nnn
nnn
sincos1
1
Observation: curves are represented by a series of line-segments
Similarly all conic sections can be represented.
-- Pn+1
Ellipse
θcos⎧ += Axxπθθ
θ20 sin
cos≤≤
⎪⎩
⎪⎨
⎧
=+=+=
o
o
o
zzByyAxx
Th t th th d i th R t tiThe computer uses the same method as in the Representation 3 of circle to reduce the amount of calculation.
3/2/2009
8
Parabola
∞≤≤⎪⎩
⎪⎨
⎧
=+=+=
uzz
AuyyAuxx
o
o
o
0 2
2
Parametric Representation of Synthetic Curves
• Analytic curves are usually not sufficient to meet geometricdesign requirements of mechanical partsdesign 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 bottles
• The need for synthetic curves in design arises onoccasions:occasions:
when a curve is represented by a collection of measureddata points and (generation)when a curve must change to meet new design requirements. (modification)
3/2/2009
9
The Order of ContinuityThe order of continuity is a term usually used to measure the degree of continuous derivatives (C0 C1 C2)
y y
i=1 i=2
i=3 i=1 i=2
i=3
the degree of continuous derivatives (C , C , C ).
x x
Simplest Case Linear Segment High order polynomial may lead to “ripples”
xaay iii 10 += niniii xaxaay +++= ...10
Splines – Ideal OrderSplines ⎯ a mechanical beam with bending deflections, or a smooth curve under multiple constraints.
(1) (2) (3)
(4)
x
y
( ) b( ) ( ) ( )
( ) ⎥⎦⎤
⎢⎣⎡ +++=
+===
iiii
ii
dxcxbxaEI
xy
EIbxa
EIxMxRxy
23
''
261 Cubic Spline
3/2/2009
10
Hermite Cubic Splines( ) ( ) ( ) ( )[ ]TuzuyuxuP ,,=
( )⎧ 23
Cubic Spline
( )( )( )⎪
⎩
⎪⎨
⎧
+++=+++=+++=
cucucucuzcucucucuycucucucux
zzzz
yyyy
xxxx
012
23
3
012
23
3
012
23
3
( ) ( ) ( ) ( ) ( )3
00 1
T ii
ip u x u y u z u Cu u
=
= = ≤ ≤⎡ ⎤⎣ ⎦ ∑vur
3×4 = 12 coefficients to be determined
0
3
3
2
1
0
2 [ ]1 [ ]
i
Tu u u U
CC
CCC
⎡
⎡ ⎤⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥
⎤ =⎣
⎦
⎦
⎣
=
v
v
v
v
v
Hermite Cubic Splines
01
12
2
3
0
33 CuCuCuCuCP
i
ii
vvvvv+++==∑
=, 2
3 2 13 2P C u C u C= + +ur v v v
p0’
4×3 equations from two
control points
⎩⎨⎧
==
=1
'0
000CPCP
u vv
vv
1 3 2 1 0'
1 3 2 1
13 2
P C C C Cu
P C C C⎧ = + + +
= ⎨= + +⎩
v v v vv
v v vv
TwoEnd
Points
u=1
p0
p1 -- p1’
u=0
--
0Pr
0 'Pr
1 'Pr
1Pr
Boundary Conditions:Location of the two end points and their slopes
3/2/2009
11
Hermite Cubic Splines
00 PC =vv
'0
' '1 0 0 1
' '0 1
1
2
0 13
3( ) 2
2( )
P
P P P P
P P P P
C
C
C
=
= − − −
= − + +
vv
v
v
rv v v
v v v v
33 2 1
3 2 1 0i
iP C u C u C u C u C= = + + +∑ur v v v v v
12 unknowns and
12 equations
3 2 1 00
ii
P C u C u C u C u C=
+ + +∑
'1
23'0
23
123
023
)()2(
)32()132()(
PuuPuuu
PuuPuuuPvr
vvv
−++−+
+−++−=
All parameters
can be determined
Hermite Cubic Splines
'23'23
123
023
)()2(
)32()132()(
PP
PuuPuuuPvr
vvv
+++
+−++−=
123
023 )()2( PuuPuuu −++−+
[ ]⎥⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢⎢
⎣
⎡
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡−−
−
=
'1
'0
1
0
23
0001010012331122
1
PPPP
uuuv
v
v
v Based on:Location of the two end points and their slopes
[ ] 10 ≤≤= uVMU HT
r
10 )23(
)143()66()66()('
12
'0
21
20
2'
≤≤−+
+−++−+−=
uPuu
PuuPuuPuuuPv
vvvr
3/2/2009
12
(u=0) (u=1)(u=1) (u=0)
m m+1--
Joining Cubic Spline Segments
(u=0) (u=1)Pm
(1) (0) ;P P Pr r r
2 curve segments & 24
' ' '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
, 1m mP +
r
1Pr
1mP +
r
1 , 1
' '1
'' ''1
(1) (0) ;
(1) (0);
(1) (0)
m m m m
m m
m m
P P P
P P
P P
+ +
+
+
= =
=
=
r r
r r
2 curve segments & 24unknowns
6 eqs. from first point, 6 eqs. from last point,
4×3 eqs. from joining point
Go through center point, have same 1st and 2nd order derivatives
Joining Cubic Spline Segments
' 2 2 2 ' 2 '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= − + − + + − + + − ≤ ≤
r v v v v
)0()1( 2''
1'' === uPuP
rr
'1
'010
'' )26()46()612()612( PuPuPuPuPvvvvr
−+−++−+−=
'1
'0101
'' 4266)1( PPPPuPvvvvr
++−==
'2
'1212
'' 2466)0( PPPPuPvvvvr
−−+−==
…
3/2/2009
13
Questions on Cubic Splines
• What are the control parameters to change the• 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 continuity on a cubic spline?
• Can I improve the order of continuity by adding more points?
Disadvantages of Cubic Splines
• The order of the curve is always constant regardlessy gof the number of data points. In order to increasethe flexibility of the curve, more points must beprovided, thus creating more spline segments whichare still of cubic order.
• 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.
3/2/2009
14
Bezier Curve• P. Bezier of the French automobile company of
Renault first introduced the Bezier curve.
- passes 0p and np , the two end points.
- has end point derivatives:
• A system for designing sculptured surfaces of automobile bodies (based on the Bezier curve)
)();( 1'
01'0 −−=−= 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 −= − = −r r r r r r
Math Expression
p1 p2 p21pr 2pr2pr
( ) ( )uBpup ni
n
ii ,
0∑=
=
p0
p3 p0
p1
pp3
0pr3pr
3pr
0pr
1pr
n — segment(each polygon)
n+1 — vertices (each polygon) and number of control points
[ ]1,0∈u
3/2/2009
15
Bernstein Polynomial
( ) ( ) ( ) inini uu
ininuB −−−
= 1!!
!,
)(, uB ni is a function of the number of curve segments, n, and i.
i 0 1 2
( )!!!
inin−
1!2!0
!2= 2
!1!1!2
= 1!0!2
!2=
i 0 1 2
( )!!!
iin 1
!2!0!2
= 2!1!1
!2= 1
!0!2!2
=
An Example: If n = 2, then n+1 = 3 vertices
-- p2
-- p1
-- p0 0pr
1pr
2pr
( ) ( ) ( ) inini uu
ininuB −−−
= 1!!
!,
( )!! ini − !2!0 !1!1 !0!2
0 1 22 2( ) (1 ) (1 )1 2 1p p pp u u u u u= × − + × − + ×
r rr r
( ) ( )uBpup ni
n
ii ,
0∑=
=
0 1 2
0 1 2
0
2
( ) (1 ) (1 )'( ) 2(1 )
12(1 2 ) 2
(0)(1)
2 1p p pp u u u u up u u p u p upp pp p
× + × + ×= − − + − +
=
=
r r r r
r r
r r1 0
2 1
'(0) 2( )'(1) 2( )
p p pp p p
= −= −
r r r
r r r
3/2/2009
16
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 p2
p3
p0 p3 p1 p2
p0
p1
p3 p0
p1
p2
p3
0
p2 p3 p1
p0 p1 p0
p2 p3
pn,p3
p1 p2
p1 p2
p1 p2
p1 pn,p3
3/2/2009
17
An Example The coordinates of four control points relative to a current WCS are given by
[ ] [ ] [ ] [ ]TTTT PPPP 023&033032022[ ] [ ] [ ] [ ]TTTT PPPP 023,&033,032,022 3210 ====
Find the equation of the resulting Bezier curve. Also find points on curve for
1,&43,2
1,41,0=u
P2P1
y ?
P0P3x
?
3/2/2009
18
Solution
( ) 103,233,223,113,00 ≤≤+++= uBPBPBPBPuP
( ) ( ) ( ) inini uu
ininuB −−−
= 1!!
!,
e.g.
( ) ( ) ( )23 2 30 1 2 3(1 ) 3 1 3 1 0 1P u u u u u uP P P Pu u= − + − + − + ≤ ≤
[ ]TPP 022)0( 0 ==
[ ]TPPPPP 0563.2156.2641
649
6427
6427
41
3210 =+++=⎟⎠⎞
⎜⎝⎛
Substituting the u values into his equation gives
u = 0, ¼, ½, ¾, 1
[ ]TPPPPP 075.25.281
83
83
81
21
3210 =+++=⎟⎠⎞
⎜⎝⎛
[ ]TPPPPP 0563.2844.26427
6427
649
641
43
3210 =+++=⎟⎠⎞
⎜⎝⎛
( ) [ ]TPP 0231 3 == P1(2,3) P2(3,3)
u=1/2
P0(2,2) P3(3,2)
u=1/4 u=3/4 - control points, P1, P2, P3, & P4,
- points on curve, P(u)
3/2/2009
19
Improvements of Bezier Curve Over the Cubic Spline
• The shape of Bezier curve is controlled only by itsThe 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+1points define a nth degree curve.Thi i t th f bi li h th d iThis 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• A Generalization from Bezier Curve
• Better local control
• Degree of resulting curve is independentto the number of control points.
3/2/2009
20
Math Representation
( ) ( ) 0n
P u N u uP u× ≤ ≤∑( ) , max0
( ) 0i
i kiP u N u uP u=
= × ≤ ≤∑
⎯ nPPP ,...,, 10 ⎯⎯ n+1 control points.
⎯ )(, uN ki ⎯⎯ B-spline function (to be calculated in a recursive
form)
(k-1) degree of polynomial with (n+1) control points
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−+
+ − +
+
+
−= − + −− −
Parametric Knots
, 1 1, 1,
( ) ( )( ) ( ) ( )i i k
i k i ki k u u
u uN u N u
Nu
uu
u u−+
+ −= − + −
:ju parametric knots (or knot values), for an open curve B-spline:
01
2j
j kj k k j n
k ju
<⎧⎪= − + ≤ ≤⎨⎪⎩
1 1i k i i k iu u uu+ − + +− −
2n k 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
≤≤
≤≤
3/2/2009
21
Knot Value Calculation
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+ + +
n = 3; 4 control pointsk = 4; 4-1=3 cubic polynomial
0 ≤ j ≤ n+k= 7
n increases – wider basek increases – wider & taller
Calculation of Function
( ) max( ) 0n
i i kP u P N u u u= × ≤ ≤∑
, ( )i kN u
( ) , max0
( )i i ki=∑
1
1,1
1
1,,
)()(
)()()(
++
−++
−+
−
−−+
−−=
iki
kiki
iki
kiiki uu
uNuu
uuuN
uuuN
a 11
1
m x
11 1
i i
i ii
u u uN u u and u u and u u
+
+
≤ <⎧⎪= = ≤ − =⎨ a 1,1 m x
0
0 00
i ii
otherwise+⎨
⎪⎩
=
3/2/2009
22
Role of B-Spline Function(Calculating Weights from Nearby Control Points)
1 1
0.75 k=3
, ( )i kN u
, ( )i kN u , ( )i kN u
Linear k=2
Quadratic
1 2
0
0.5
0 1 2 3 4
u u
0 1 2 3 40 1 2
0.5
, ( )i kN u
Cubic k=4
2/3
1/6
1 2 3 4
u
0 1 2 3 4
Properties of B-Spline• Number of control points independent of degree of
polynomialp y
Quadratic B-SplineCubic B-SplineFourth Order B-Spline
k=4k=3
k=5Linear k=2
vertex
vertex
vertex
The higher the order of the B-Spline, the less the
influence the close control point
n=3; 4 control pointsvertex
3/2/2009
23
Properties of B-Spline
• B-spline allows better local control. Shape of the curve can be adjusted by moving the control points. j y g p
• Local control: a control point only influences k segments.
2 3
7 5’’’
1
4
5 6
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 repeated
control points to pull the
curve
Same order polynomial
3/2/2009
24
Bezier CurveDifferent order
polynomial
An Example
Find the equation of a cubic Bcubic B--spline curvespline curve defined q ppby the same control points as in the last example.
How does the curve compare with the Bezier curve?
3/2/2009
25
Example Problem for pFinding the Bezier Curve
Example Problem for Finding the Bezier Curve
3/2/2009
26
Finding the B-Spline Curve for the Same Example Problem
Values to be Calculated
n = 3; 4 control pointsk = 4; 4-1=3 cubic polynomial
uj: 0 ≤ j ≤ n+k= 7
n increases – wider basek increases – wider & taller
3/2/2009
27
Calculating the Knots, uj
Calculating Ni,1
000
011
1
1max
1
1,
=
⎪⎩
⎪⎨
⎧=−≤=
<≤= +
+
otherwiseuuanduuanduu
uuuN ii
ii
i
0
3/2/2009
28
Calculating Ni,k
Calculating Ni,k
3/2/2009
29
Result
n + 1 control points: 3+1=4k – 1 degree curve: 4-1=3
4 control points – cubic polynomial
Non-uniform Rational B-Spline Curve (NURBS)
Rational B-Spline
( ) , max0
( ) 0n
ki
i iP u u u uRP=
= × ≤ ≤∑
,,
,0
( )( )
( )
i i ki k in
i i ki
h N uR h scalar
h N u= −
∑0i=
If )()( then ,1 ,, uNuRh kikii == ,it is the representation of a B-Spline curve.
Industry Standard Today!
3/2/2009
30
Development of NURBS
• Boeing: Tiger System in 1979
• SDRC: Geomod in 1993
• University of Utah: Alpha-1 in 1981
• Industry Standard: IGES, PHIGS, PDES, y , , ,Pro/E, etc.
3/2/2009
31
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 standardOffer 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 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
3/2/2009
32
n + 1 – number of control points; & k – degree of the curve (polynomial)
• For B-spline, k should always be less than or equal to n+1. T or F?
Quick Questions
p y qwhy?
• What are the two major advantages of B-spline over Bezier curve in real design?
• If k increases in its reasonable range, will the corresponding B-spline curve move closer to the control polygon.?
• What are the required user inputs to construct a Hermite Cubic, Bezier, B-spline and NURBS curve segment?, p g
• By 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?