Вы находитесь на странице: 1из 10

1

Parametric Curves
Thomas Funkhouser
Princeton University
COS 426, Spring 2006
3D Object Representations
Raw data
Voxels
Point cloud
Range image
Polygons
Surfaces
Mesh
Subdivision
Parametric
Implicit
Solids
Octree
BSP tree
CSG
Sweep
High-level structures
Scene graph
Application specific
3D Object Representations
Raw data
Voxels
Point cloud
Range image
Polygons
Surfaces
Mesh
Subdivision
Parametric
Implicit
Solids
Octree
BSP tree
CSG
Sweep
High-level structures
Scene graph
Application specific
Parametric Surfaces
Applications
Design of smooth surfaces in cars, ships, etc.
H&B Figure 10.46
Parametric Surfaces
Boundary defined by parametric functions:
x = f
x
(u,v)
y = f
y
(u,v)
z = f
z
(u,v)
Example: ellipsoid
H&B Figure 10.10



sin
sin cos
cos cos
z
y
x
r z
r y
r x
=
=
=
Parametric Surfaces
Boundary defined by parametric functions:
x = f
x
(u,v)
y = f
y
(u,v)
z = f
z
(u,v)
FvDFH Figure 11.42
u
v
x
y
z
u
v
Parametric functions
define mapping from
(u,v) to (x,y,z):
2
Parametric Curves
Boundary defined by parametric functions:
x = f
x
(u)
y = f
y
(u)
Example: ellipse
H&B Figure 10.10

sin
cos
y
x
r y
r x
=
=
x
y

r
x
r
y
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
Curves in Computer Graphics
Fonts
Animation paths
Shape modeling
etc
Animation
(Angel, Plate 1)
Shell
(Douglas Turnbull,
CS 426, Fall99)
Parametric curves
How can we define arbitrary curves?
x = f
x
(u)
y = f
y
(u)
Parametric curves
How can we define arbitrary curves?
x = f
x
(u)
y = f
y
(u)
Use functions that blend control points
x = f
x
(u) = V0
x
*(1 - u) + V1
x
*u
y = f
y
(u) = V0
y
*(1 - u) + V1
y
*u
V0
V1
Parametric curves
More generally:
x
n
i
i
Vi u B u x * ) ( ) (
0

=
=
y
n
i
i
Vi u B u y * ) ( ) (
0

=
=
V
0
V
1
V
2
V
3
x(u), y(u)
3
Parametric curves
What B(u) functions should we use?
x
n
i
i
Vi u B u x * ) ( ) (
0

=
=
y
n
i
i
Vi u B u y * ) ( ) (
0

=
=
Parametric curves
What B(u) functions should we use?
x
n
i
i
Vi u B u x * ) ( ) (
0

=
=
y
n
i
i
Vi u B u y * ) ( ) (
0

=
=
B
0
B
1
V0
V1
u
1
1
0
0
1
1
0
0 u
Parametric curves
What B(u) functions should we use?
x
n
i
i
Vi u B u x * ) ( ) (
0

=
=
y
n
i
i
Vi u B u y * ) ( ) (
0

=
=
B
0
u
1
1
0
0
V0
V1
V2
B
1
u
1
1
0
0
B
2
u
1
1
0
0
Goals
Some attributes we might like to have:
Efficient computation
Predictable control
Local control
Interpolation
Continuity
Continuity
Parametric continuity (C
n
)
How many times differentiable is the
curve with respect to u at a given point
Parametric continuity at joints:
C
0
continuity means curve is connected at joint
C
1
continuity means that segments
share same first derivative at joint
C
n
continuity means that segments
share same nth derivative at joint
Relationships
C
n
implies C
n-1
V
1
V
2
V
3
V
4
V
5
V
6
V
0
Continuity
Geometric continuity (G
n
)
How many times differentiable is the
curve with respect to x,y at a given point
Relationships:
C
n
implies G
n
, but not vice-versa
V
1
V
2
V
3
V
4
V
5
V
6
V
0
4
Goals
Some attributes we might like to have:
Efficient computation
Predictable control
Local control
Interpolation
Continuity
Well satisfy these goals using:
Piecewise
Parametric
Polynomials
Parametric Polynomial Curves
Blending functions are polynomials:
Advantages of polynomials
Easy to compute
Infinitely continuous
Easy to derive curve properties

=
=
m
j
j
j i
u a u B
0
) (
x
n
i
i
Vi u B u x * ) ( ) (
0

=
=
y
n
i
i
Vi u B u y * ) ( ) (
0

=
=
V
1
V
2
V
3
V
5
V
6
V
0
V
4
Parametric Polynomial Curves
Blending functions are polynomials:
Advantages of polynomials
Easy to compute
Infinitely continuous
Easy to derive curve properties

=
=
m
j
j
j i
u a u B
0
) ( V
1
V
2
V
3
V
5
V
6
V
0
V
4
i
n
i
i
V u B u Q * ) ( ) (
0

=
=
Piecewise Parametric Polynomial Curves
Splines:
Split curve into segments
Each segment defined by low-order polynomial
blending subset of control vertices
Motivation:
Provides control & efficiency
Same blending function for every segment
Prove properties from blending functions
Challenges
How choose blending functions?
How guarantee continuity at joints?
V
1
V
2
V
3
V
5
V
6
V
0
V
4
Piecewise Parametric Polynomial Curves
Compute polynomial B
i
(u) to ensure properties
Example: interpolation of control vertices
and C
2
continuity at joints with cubics
V
1
V
2
V
3
V
5
V
6
V
0
B
i
u
1
0
V
0
V
1
V
2
V
3
V
4
V
5
V
6
-1
V
4
Cubic Piecewise Parametric Polynomial Curves
From now on, consider cubic blending functions
All ideas generalize to higher degrees
In CAGD, higher-order functions are often used
Hard to control wiggles
In graphics, piecewise cubic curves will do
Smallest degree that allows C
2
continuity
for arbitrary curves
5
Types of Splines
Splines covered in this lecture
Hermite
B-Spline
Bezier
There are many others
Each has different blending functions
resulting in different properties
Each has different blending functions
resulting in different properties
Cubic Hermite Splines
Definition:
Each segment defined by
position and derivative at
two adjacent control vertices
Blending functions are
cubic polynomials
4(n-1) degrees of freedom
V
1
V
2
V
3
V
4
V
5
V
6
V
0
3
3
2
2 1 0
) ( u a u a u a a u B + + + =
Cubic Hermite Splines
Definition:
Each segment defined by
position and derivative at
two adjacent control vertices
Blending functions are
cubic polynomials
V
1
V
0
Q
Q(u) = B
0
(u)*V
0
+ B
1
(u)*V
1
+ B
2
(u)*D
0
+ B
3
(u)*D
1
D
0
D
1
3
3
2
2 1 0
) ( u a u a u a a u B + + + =
Cubic Hermite Splines
Definition:
4(n-1) degrees of freedom
Properties:
Interpolates control points
2(n-2) constraints:
V
1
V
2
V
3
V
4
V
5
V
6
V
0
Q
i
(0)=V
i
and Q
i
(1)=V
i+1
3
3
2
2 1 0
) ( u a u a u a a u B + + + =
Natural Cubic Hermite Splines
Definition:
4(n-1) degrees of freedom
Properties:
Interpolates control points
2(n-2) constraints:
C
2
continuity
2(n-1) constraints:
V
1
V
2
V
3
V
4
V
5
V
6
V
0
Q
i
(0)=V
i
and Q
i
(1)=V
i+1
Q
i
(1)=Q
i+1
(0) and Q
i
(1)=Q
i+1
(0)
3
3
2
2 1 0
) ( u a u a u a a u B + + + =
Natural Cubic Hermite Splines
Definition:
4(n-1) degrees of freedom
Properties:
Interpolates control points
2(n-2) constraints:
C
2
continuity
2(n-1) constraints:
V
1
V
2
V
3
V
4
V
5
V
6
V
0
Q
i
(0)=V
i
and Q
i
(1)=V
i+1
Q
i
(1)=Q
i+1
(0) and Q
i
(1)=Q
i+1
(0)
Solve system of equation for
coefficients of blending functions
3
3
2
2 1 0
) ( u a u a u a a u B + + + =
6
Natural Cubic Hermite Splines
Problems:
No local control
Whole curve adjusts to
any movement of control vertex
Every segment has different blending functions
Hard to prove properties
V
1
V
2
V
3
V
6
V
0
V
4
V
5
Uniform Cubic Hermite Splines
Definition:
Each segment defined by
position and derivative at
two adjacent control vertices
Blending functions are
cubic polynomials
Properties:
Interpolates control points
Same blending function for every segment
Local control
C
1
continuity at joints
V
1
V
2
V
3
V
4
V
5
V
6
V
0
3
3
2
2 1 0
) ( u a u a u a a u B + + + =
Uniform Cubic Hermite Splines
Blending functions:
B
0
B
1
1
1
0
0
B
2
B
3
V
1
V
2
V
3
V
4
V
5
V
6
V
0
1
1
0
0
1
1
0
0
Q(u) = B
0
(u)*V
i
+ B
1
(u)*V
i+1
+ B
2
(u)*D
i
+ B
3
(u)*D
i+1
1
1
0
0
D
2
D
3
Types of Spline Curves
Splines covered in this lecture
Hermite
B-Spline
Bezier
There are many others
Each has different blending functions
resulting in different properties
Each has different blending functions
resulting in different properties
Uniform Cubic B-Splines
Properties:
Local control
C
2
continuity
Approximating
V
1
V
2
V
3
V
4
V
5
V
0
B-Spline Blending Functions
Properties imply blending functions:
Cubic polynomials
Four control vertices affect each point
C
2
continuity
V
1
V
2
V
3
V
4
V
5
V
0
u
1
0
V
0
V
1
V
2
V
3
V
4
V
5
7
B-Spline Blending Functions
How derive blending functions?
Cubic polynomials
Local control
C
2
continuity
V
1
V
2
V
3
V
4
V
5
V
0
u
1
0
V
0
V
1
V
2
V
3
V
4
V
5
b
-3
b
-2
b
-1
b
-0
B-Spline Blending Functions
Four cubic polynomials for four vertices
16 variables (degrees of freedom)
Variables are a
i
, b
i
, c
i
, d
i
for
four blending functions
V
1
V
2
V
3
V
4
V
5
V
0
3
1
3
2
3
3
3 3
2
1
2
2
2
3
2 2
1
1
1
2
1
3
1 1
0
1
0
2
0
3
0 0
) (
) (
) (
) (
d u c u b u a u b
d u c u b u a u b
d u c u b u a u b
d u c u b u a u b
+ + + =
+ + + =
+ + + =
+ + + =

B-Spline Blending Functions


C2 continuity implies 15 constraints
Position of two curves same
Derivative of two curves same
Second derivatives same
V
1
V
2
V
3
V
4
V
5
V
0
B-Spline Blending Functions
B-Spline Blending Functions
Solving the system of equations yields:
B-Spline Blending Functions
In matrix form:
( )


=
3
2
1
0
2 3

0 1 4 1
0 3 0 3
0 3 6 3
1 3 3 1

6
1
1 ) (
V
V
V
V
u u u u Q
8
B-Spline Blending Functionss
In plot form:

=
=
m
j
j
j i
u a u B
0
) (
b
-0
1
1
0
0
b
-1
1
1
0
0
b
-2
1
1
0
0
b
-3
1
1
0
0
V
1
V
2
V
3
V
4
V
5
V
0
B-Spline Blending Functions
Blending functions imply properties:
Local control
Approximating
C
2
continuity
Convex hull
V
1
V
2
V
3
V
4
V
5
V
0
u
1
0
V
0
V
1
V
2
V
3
V
4
V
5
Types of Splines
Splines covered in this lecture
Hermite
B-Spline
Bezier
There are many others
Each has different blending functions
resulting in different properties
Each has different blending functions
resulting in different properties
Bezier curves
Blending functions:

=
=
m
j
j
j i
u a u B
0
) (
B
i-3
1
1
0
0
B
i-2
1
1
0
0
B
i-1
1
1
0
0
B
i
1
1
0
0
V
1
V
2
V
3
V
4
V
5
V
6
V
0
Matrix form
Bzier curves may be described in matrix form:
( )


=
+ + + =

=

=

3
2
1
0
2 3
3
3
2
2
1
2
0
3
0

0 0 0 1
0 0 3 3
0 3 6 3
1 3 3 1
1
) 1 ( 3 ) 1 ( 3 ) 1 (
) 1 ( ) (
V
V
V
V
u u u
V u V u u V u u V u
u u
i
n
V u Q
i n i
n
i
i
M
Bezier
Basic properties of Bzier curves
Endpoint interpolation:
Convex hull:
Curve is contained within convex hull of control polygon
Symmetry
0
) 0 ( V Q =
n
V Q = ) 1 (
} ,..., { by defined ) 1 ( } ,..., { by defined ) (
0 0
V V u Q V V u Q
n n

9
Bzier curves
Curve Q(u) can also be defined by
nested interpolation:
V
i
s are control points
{V
0
, V
1
, , V
n
} is control polygon
V
0
V
1
V
2
V
3
Q(u)
Display
Q: How would you draw it using line segments?
A: Recursive subdivision!
V
0
V
1
V
2
V
3
Display
Pseudocode for displaying Bzier curves:
procedure Display({V
i
}):
if {V
i
} flat within
then
output line segment V
0
V
n
else
subdivide to produce {L
i
} and {R
i
}
Display({L
i
})
Display({R
i
})
end if
end procedure
Flatness
Q: How do you test for flatness?
A: Compare the length of the control polygon
to the length of the segment between endpoints
+ <

+ +
1
| |
| | | | | |
0 3
2 3 1 2 0 1
V V
V V V V V V
V
0
V
1
V
2
V
3
Bezier Splines
For more complex curves,
piece together Bzier curves
Solve for interior control vertices
Positional (C
0
) continuity
Derivative (C
1
) continuity
Bezier Splines
Patrick Min
10
Summary
Splines: mathematical way to express curves
Motivated by loftsmans spline
Long, narrow strip of wood/plastic
Used to fit curves through specified data points
Shaped by lead weights called ducks
Gives curves that are smooth or fair
Have been used to design:
Automobiles
Ship hulls
Aircraft fuselage/wing
Whats next?
Use curves to create parameterized surfaces
Q(u,v)
Q(0,0)
Q(1,0)
Q(0,1)
Q(1,1)
Watt Figure 6.21

Вам также может понравиться