cs559-23 (1)
TRANSCRIPT
-
7/30/2019 cs559-23 (1)
1/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Last Time
Subdivision
Sphere
Fractals
Modified Butterfly scheme
Implicit Surfaces
-
7/30/2019 cs559-23 (1)
2/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Today
Parametric curves
Hermite curves
Bezier curves
Homework 7 due Thursday Dec 9
Will be available for collection early in exam week
Best 5 of 7 homeworks are used to compute grade, each one equally
weighted
-
7/30/2019 cs559-23 (1)
3/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Subdivision Shortcomings
Subdivision surfaces suffer from parameterization problems
How are texture coordinates handled?
Surface are 2D in nature, how do we attached a 2D space to
subdivision surfaces?
Subdivision surfaces can be difficult to model with
Still may take complex underlying surface to get desired shape
Effects of changes to underlying mesh are not always obvious
Evaluation is non-trivial
Methods exist for taking a point in the underlying mesh and figuringout where it will go on the surface, but it isnt easy
-
7/30/2019 cs559-23 (1)
4/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
What are Parametric Curves?
Define a parameter space
1D for curves
2D for surfaces
Define a mapping from parameter space to 3D points
A function that takes parameter values and gives back 3D points
The result is a parametric curve or surface
0 t1
Mapping:F:t(x,y)
0
1(Fx(t), Fy(t))
-
7/30/2019 cs559-23 (1)
5/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Why Parametric Curves?
Parametric curves are intended to provide the generality of
polygon meshes but with fewer parameters for smooth
surfaces
Polygon meshes have as many parameters as there are vertices (at
least)
Fewer parameters makes it faster to create a curve, and
easier to edit an existing curve
Normal vectors and texture coordinates can be easily
defined everywhere
Parametric curves are easier to animate than polygon
meshes
-
7/30/2019 cs559-23 (1)
6/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Parametric Curves
We have seen the parametric form for a line:
Note that x, y and z are each given by an equation that
involves:
The parameter t
Some user specified control points,x0 andx1 This is an example of a parametric curve
10
10
10
)1(
)1(
)1(
tzztz
tyyty
txxtx
-
7/30/2019 cs559-23 (1)
7/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Basis Functions (first sighting)
A line is the sum of two functions multiplied by vectors:
A linear combination ofbasis functions
tand 1-tare the basis functions
The weights are called control points (x0,y0,z0) and (x1,y1,z1) are the control points
They control the shape and position of the curve
1
1
1
0
0
0
1
z
y
x
t
z
y
x
t
z
y
x
-
7/30/2019 cs559-23 (1)
8/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Hermite Spline
A spline is a parametric curve defined by control points
The term spline dates from engineering drawing, where a spline wasa piece of flexible wood used to draw smooth curves
The control points are adjusted by the userto control the shape ofthe curve
AHermite spline is a curve for which the user provides:
The endpoints of the curve
The parametric derivatives of the curve at the endpoints (tangentswith length)
The parametric derivatives are dx/dt, dy/dt, dz/dt That is enough to define a cubic Hermite spline
-
7/30/2019 cs559-23 (1)
9/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Control Point Interpretation
0
x
0
dt
dx1dt
dx
1x
Start Point
End Point
Start Tangent End Tangent
-
7/30/2019 cs559-23 (1)
10/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Hermite Spline (2)
Say the user provides
A cubic spline has degree 3, and is of the form:
For some constants a, b, c and d derived from the control points, but
how?
We have constraints:
The curve must pass throughx0 when t=0
The derivative must be x0 when t=0
The curve must pass throughx1 when t=1
The derivative must be x1 when t=1
dctbtatx
23
1
1
0
0
10 ,,,dt
ddt
d xxxx
-
7/30/2019 cs559-23 (1)
11/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Hermite Spline (3)
Solving for the unknowns gives:
Rearranging gives:0
0
0101
0101
233
22
xd
xc
xxxxb
xxxxa
)2(
)(
)132(
)32(
230
23
1
23
0
23
1
ttt
tt
tt
tt
x
x
x
xx
10121
0011
1032
0032
2
3
0101t
t
t
xxxxxor
-
7/30/2019 cs559-23 (1)
12/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Basis Functions
A point on a Hermite curve is obtained by multiplying each
control point by some function and summing
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
x1
x0
x'1
x'0
-
7/30/2019 cs559-23 (1)
13/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Splines in 2D and 3D
For higher dimensions, define the control points in higher
dimensions (that is, as vectors)
10121
0011
1032
0032
2
3
0101
0101
0101
t
t
t
zzzz
yyyyxxxx
z
yx
-
7/30/2019 cs559-23 (1)
14/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Bezier Curves (1)
Different choices of basis functions give different curves
Choice of basis determines how the control points influence the
curve
In Hermite case, two control points define endpoints, and two more
define parametric derivatives
For Bezier curves, two control points define endpoints, and
two control the tangents at the endpoints in a geometric way
-
7/30/2019 cs559-23 (1)
15/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Control Point Interpretation
0
x
3x
Start Point
End Point
Point along start tangent
Point along end Tangent
2x
1x
-
7/30/2019 cs559-23 (1)
16/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Bezier Curves (2)
The user supplies dcontrol points, pi
Write the curve as:
The functionsBidare theBernstein polynomials of degree d
Where else have you seen them?
This equation can be written as a matrix equation also
There is a matrix to take Hermite control points to Bezier controlpoints
d
i
d
ii tBt
0
px ididi tti
dtB
1
-
7/30/2019 cs559-23 (1)
17/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Bezier Basis Functions for d=3
0
0.2
0.4
0.6
0.8
1
1.2
B0B1
B2
B3
-
7/30/2019 cs559-23 (1)
18/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Bezier Curves of Varying Degree
-
7/30/2019 cs559-23 (1)
19/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Bezier Curve Properties
The first and last control points are interpolated
The tangent to the curve at the first control point is along theline joining the first and second control points
The tangent at the last control point is along the line joining
the second last and last control points The curve lies entirely within the convex hull of its control
points The Bernstein polynomials (the basis functions) sum to 1 and are
everywhere positive
They can be rendered in many ways
E.g.: Convert to line segments with a subdivision algorithm
-
7/30/2019 cs559-23 (1)
20/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Rendering Bezier Curves (1)
Evaluate the curve at a fixed set of parameter
values and join the points with straight lines
Advantage: Very simple
Disadvantages: Expensive to evaluate the curve at many points
No easy way of knowing how fine to sample
points, and maybe sampling rate must be different
along curve
No easy way to adapt. In particular, it is hard tomeasure the deviation of a line segment from the
exact curve
-
7/30/2019 cs559-23 (1)
21/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Rendering Bezier Curves (2)
Recall that a Bezier curve lies entirely within the convex
hull of its control vertices
If the control vertices are nearly collinear, then the convex
hull is a good approximation to the curve
Also, a cubic Bezier curve can be subdividedinto two
shorter curves that exactly cover the original
This suggests an algorithm:
Keep breaking the curve into sub-curves
Stop when the control points of each sub-curve are nearly collinear
Draw the control polygon - the polygon formed by the control points
-
7/30/2019 cs559-23 (1)
22/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Invariance
Translational invariance means that translating the control points and
then evaluating the curve is the same as evaluating and then translating
the curve
Rotational invariance means that rotating the control points and then
evaluating the curve is the same as evaluating and then rotating the
curve
These properties are essential for parametric curves used in graphics
It is easy to prove that Bezier curves, Hermite curves and everything
else we will study are translation and rotation invariant
Some forms of curves, rational splines, are alsoperspective invariant Can do perspective transform of control points and then evaluate the curve
-
7/30/2019 cs559-23 (1)
23/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Longer Curves
A single cubic Bezier or Hermite curve can only capture a small class ofcurves
At most 2 inflection points
One solution is to raise the degree
Allows more control, at the expense of more control points and higher
degree polynomials Control is not local, one control point influences entire curve
Alternate, most common solution is to join pieces of cubic curvetogether intopiecewise cubic curves
Total curve can be broken into pieces, each of which is cubic
Local control: Each control point only influences a limited part of the curve Interaction and design is much easier
-
7/30/2019 cs559-23 (1)
24/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Piecewise Bezier Curve
knot
P0,0
P0,1 P0,2
P0,3
P1,0
P1,1
P1,2
P1,3
-
7/30/2019 cs559-23 (1)
25/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Continuity
When two curves are joined, we typically want some degree
of continuity across the boundary (the knot)
C0, C-zero, point-wise continuous, curves share the same point
where they join
C1, C-one, continuous derivatives, curves share the sameparametric derivatives where they join
C2, C-two, continuous second derivatives, curves share the same
parametric second derivatives where they join
Higher orders possible
-
7/30/2019 cs559-23 (1)
26/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Bezier Continuity
P0,0
P0,1 P0,2
J
P1,1
P1,2
P1,3
Disclaimer: PowerPoint curves are not Bezier curves, they areinterpolating piecewise quadratic curves! This diagram is an
approximation.
-
7/30/2019 cs559-23 (1)
27/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Sketch of Proof for C1
3
3
32
2
32
1
32
0
3
3
2
2
2
1
3
0
)(3)2(3)331(
)1(3)1(3)1(
ttttttttt
tttttt
xxxx
xxxxx
2
3
2
2
2
1
2
0 3)32(3)341(3)363( tttttttdt
dxxxx
x
Bezier curve equation:
Parametric derivative:
)(333 23321
xxxxx
tdt
d)(333 0110
0
xxxxx
tdt
d
Evaluated at endpoint of curve (note proves tangent property):
-
7/30/2019 cs559-23 (1)
28/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Proof (cont)
P0,0
P0,1 P0,2
J
P1,1 P1,2
P1,3
2,01,1
2,01,1 )(3)(3
PJJP
PJJP
C1 requires equal parametric derivatives:
-
7/30/2019 cs559-23 (1)
29/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Geometric Continuity
Derivative continuity is important for animation
If an object moves along the curve with constant parametric speed, thereshould be no sudden jump at the knots
For other applications, tangent continuity might be enough
Requires that the tangents point in the same direction
Referred to as G1 geometric continuity Curves couldbe made C1 with a re-parameterization: u=f(t)
The geometric version ofC2 is G2, based on curves having the same radiusof curvature across the knot
What is the tangent continuity constraint for a Bezier curve?
-
7/30/2019 cs559-23 (1)
30/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Bezier Geometric Continuity
P0,0
P0,1 P0,2
J
P1,1 P1,2
P1,3
)()( 2,01,1 PJJP k for some k
-
7/30/2019 cs559-23 (1)
31/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Parametric Surfaces
Define points on the surface in terms of two parameters
Simplest case: bilinear interpolation
s
t
s
x(s,t)
P0,0
P1,0
P1,1P0,1
x(s,0)
x(s,1)
1
0
1
0
,,,
,1,0
,1,0
1,11,0
0,10,0
)()(),(
,1
,1
)1,()0,()1(),(
)1()1,(
)1()0,(
i j
tjsiji
tt
ss
tFsFPtsx
tFtF
sFsF
stxsxttsx
sPPssx
sPPssx
-
7/30/2019 cs559-23 (1)
32/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Tensor Product Surface Patches
Defined over a rectangular domain
Valid parameter values come from within a rectangular region in
parameter space: 0s
-
7/30/2019 cs559-23 (1)
33/34
12/2/2004 University of Wisconsin, CS559 Fall 2004
Bezier Patches
As with Bezier curves,Bin(s) and
Bjm
(t) are the Bernstein polynomialsof degree n and m respectively
Most frequently, use n=m=3: cubicBezier patch
Need 4x4=16 control points, Pi,j
n
i
m
j
m
j
n
iji tBsBts0 0
,, Px
-
7/30/2019 cs559-23 (1)
34/34
12/2/2004 University of Wisconsin CS559 Fall 2004
Bezier Patches (2)
Edge curves are Bezier curves
Any curve of constant s or tis a Bezier curve
One way to think about it:
Each row of 4 control points defines a Bezier curve in s
Evaluating each of these curves at the same s provides 4 virtual control
points The virtual control points define a Bezier curve in t
Evaluating this curve at tgives the point x(s,t)
x(s,t)