Parametric Curves Jason Lawrence Princeton University COS 426, Spring 2005 Curves in Computer Graphics • Fonts ABC • Animation paths • Shape modeling • etc… Animation (Angel, Plate 1) Shell (Douglas Turnbull, CS 426, Fall99) Implicit curves An implicit curve in the plane is expressed as: f(x, y) = 0 Example: a circle with radius r centered at origin: x 2 + y 2 -r 2 = 0 x y r Parametric curves A parametric curve in the plane is expressed as: x = f x (u) y = f y (u) Example: a circle with radius r centered at origin: x = r cos u y = r sin u x y r
11
Embed
Curves in Computer Graphics ABC · 2005-04-01 · Curves in Computer Graphics ... o C1 continuity means that segments share same first derivative at joint o Cn continuity means that
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
Parametric Curves
Jason LawrencePrinceton University
COS 426, Spring 2005
Curves in Computer Graphics
• Fonts ABC• Animation paths
• Shape modeling
• etc…
Animation(Angel, Plate 1)
Shell(Douglas Turnbull,
CS 426, Fall99)
Implicit curvesAn implicit curve in the plane is expressed as:
f(x, y) = 0
Example: a circle with radius r centered at origin:
x2 + y2 - r2 = 0
x
y
r
Parametric curvesA parametric curve in the plane is expressed as:
x = fx(u)y = fy(u)
Example: a circle with radius r centered at origin:
x = r cos uy = r sin u
x
y
r
2
Parametric curvesHow can we define arbitrary curves?
x = fx(u)y = fy(u)
Parametric curvesHow can we define arbitrary curves?
Each has different blending functionsresulting in different properties
Each has different blending functionsresulting in different properties
Bezier curvesBlending functions:
∑=
=m
j
jji uauB
0
)(
Bi-3
1
1
00
Bi-2
1
1
00
Bi-1
1
1
00
Bi
1
1
00
V1
V2V3
V4
V5
V6
V0
Bézier curves• Developed simultaneously in 1960 by
o Bézier (at Renault) o deCasteljau (at Citroen)
• Curve Q(u) is defined by nested interpolation:
Vi’s are control points{V0, V1, …, Vn} is control polygon
V0
V1
V2
V3
Q(u)
7
Basic properties of Bézier curves• Endpoint interpolation:
• Convex hull: o Curve is contained within convex hull of control polygon
• Symmetry
0)0( VQ =
nVQ =)1(
},...,{by defined )1( },...,{by defined )( 00 VVuQVVuQ nn −≡
Explicit formulation• Let’s indicate level of nesting with superscript j:
• An explicit formulation of Q(u) is given by:
• Case n=3 (expand recurrence):
11
1)1( −+
− +−= ji
ji
ji uVVuV
]......)1[(])1)[(1)[(1(
])1[(])1)[(1(
)1(
)(
02
01
01
00
12
11
11
10
21
20
30
uVVuuuVVuuu
uVVuuuVVuu
uVVu
VuQ
+−++−−−=
+−++−−=
+−=
=
More properties• General case: Bernstein polynomials
• Degree: is a polynomial of degree n
• Tangents:)()1('
)()0('
1
01
−−=−=
nn VVnQVVnQ
inin
ii uu
in
VuQ −
=
−
= ∑ )1( )(
0
Matrix formBézier curves may be described in matrix form:
( )
−−
−−
=
+−+−+−=
−
= −
=∑
3
2
1
0
23
33
22
12
03
0
0001003303631331
1
)1(3)1(3)1(
)1( )(
VVVV
uuu
VuVuuVuuVu
uuin
VuQ inin
ii
MBezier
8
DisplayQ: How would you draw it using line segments?
A: Recursive subdivision!
V0
V1
V2
V3
DisplayPseudocode for displaying Bézier curves:
procedure Display({Vi}):if {Vi} flat within εthen
output line segment V0Vnelse
subdivide to produce {Li} and {Ri}Display({Li})Display({Ri})
end ifend procedure
FlatnessQ: How do you test for flatness?
A: Compare the length of the control polygonto the length of the segment between endpoints
ε+<−
−+−+− 1||
||||||
03
231201
VVVVVVVV
V0
V1
V2
V3
Splines• For more complex curves, piece together Béziers
• We want continuity across joints:o Positional (C0) continuityo Derivative (C1) continuity
• Q: How would you satisfy continuity constraints?
• Q: Why not just use higher-order Bézier curves?
• A: Splines have several of advantages:• Numerically more stable
• Easier to compute
• Fewer bumps and wiggles
9
Types of Splines• Splines covered in this lecture
o Hermite o Bezier!Catmull-Romo B-Spline
• There are many others
Each has different blending functionsresulting in different properties
Each has different blending functionsresulting in different properties
Catmull-Rom splines• Properties
o Interpolate control pointso Have C0 and C1 continuity
• Derivationo Start with joints to interpolateo Build cubic Bézier between each jointo Endpoints of Bézier curves are obvious
• What should we do for the other Bézier control points?
Catmull-Rom Splines• Catmull & Rom use:
o half the magnitude of the vector between adjacent CP’s
• Many other formulations work, for example:o Use an arbitrary constant τ times this vectoro Gives a “tension” control o Could be adjusted for each joint
Properties• Catmull-Rom splines have these attributes:
o C1 continuity
o Interpolation
o Locality of control
o No convex hull property
(Proof left as an exercise.)
10
Types of Splines• Splines covered in this lecture
o Hermite o Beziero Catmull-Rom!B-Spline
• There are many others
Each has different blending functionsresulting in different properties
Each has different blending functionsresulting in different properties
B-Splines• Properties:
o Local controlo C2 continuityo Cubic polynomials
• Constraints:o Three continuity conditions at each joint j
» Position of two curves same» Derivative of two curves same» Second derivatives same
o Local control» Each joint affected by 4
control vertices
• Give up interpolation :)
V1
V2V3
V5
V0
Matrix formulation for B-splines• List mathematical constraints:
• Grind through some messy math to get:
0141030303631331
61
−−
−−
=BSPLINEM
( )
=−
−
−
i
i
i
i
BSPLINEi
VVVV
MuuuuQ1
2
3
23 1)()0('')1(''
)0(')1(')0()1(
1
1
1
+
+
+
===
ii
ii
ii
QQQQ
QQ
B-Splines• Blending functions:
o Local control: how can we tell?o Interpolates control points?
u
1
0
V0 V1 V2 V3 V4 V5
V1
V2V3
V5
V0
11
Summary• Splines: mathematical way to express curves
• Motivated by “loftsman’s spline”o Long, narrow strip of wood/plastico Used to fit curves through specified data pointso Shaped by lead weights called “ducks”o Gives curves that are “smooth” or “fair”
• Have been used to design:o Automobileso Ship hullso Aircraft fuselage/wing
What’s next?• Use curves to create parameterized surfaces