Академический Документы
Профессиональный Документы
Культура Документы
By
Ulf Assarsson
Most of the material is originally made by Edward Angel and is
adapted to this course by Ulf Assarsson. Some material is made by
Magnus Bondesson
Utah Teapot
Most famous data set in computer graphics
Widely available as a list of 306 3D vertices and
the indices that define 32 Bezier patches
A Bezier patch
Objectives
Introduce types of curves and surfaces
Explicit
Implicit
Parametric
Modeling with Curves
Extension to 3D y
p(umax)
p(umin)
Selecting Functions
p(0) = p0
p(1)= p0 +d
Ray from p0 in the direction d
p(u)=p0+ud d
p(0) = p0
Parametric Surfaces
Surfaces require 2 parameters
y p(u,1)
x=x(u,v)
y=y(u,v) p(0,v)
p(1,v)
z=z(u,v) x
T z p(u,0)
p(u,v) = [x(u,v), y(u,v), z(u,v)]
Want same properties as curves:
Smoothness
Differentiability
Ease of evaluation
Normals
We can differentiate with respect to u and v to
obtain the normal at any point p
x (u, v) / u x (u, v) / v
p(u, v) p(u, v)
= y(u, v) / u = y(u, v) / v
u v
z(u, v) / u z(u, v) / v
v
p(u, v) p(u, v)
n=
u v
u
Parametric Planes
n
point-vector form
r
p(u,v)=p0+uq+vr
p(u,v) p(u,v)
q
u v n=qxr
p0 n
(three-point form p2
q = p1 p0 p1
r = p2 p0 )
p0
Curve Segments
After normalizing u, each curve is written
p(u)=[x(u), y(u), z(u)]T, 1 u 0
In classical numerical methods, we design a
single global curve
In computer graphics and CAD, it is better to
design small connected curve segments
p(u) join point p(1) = q(0)
q(1)
q(u)
p(0)
q(u)
Remember: p(u)
Cubic polynomials gives N=M=L=3 x=x(u)
p(umin) p(umax)
y=y(u)
z=z(u)
c 0 1
u
c1
define c= u = 2
c 2 u
3
c3 u
T T
then p(u ) = u c = c u
Interpolating Curve
p1 p3
p0 p2
1 0 0 0
1
5.5 9 4.5 1
MI = A =
9 22.5 18
4.5
4.5 13 .5 13 .5 4.5
c=MIp
Note that MI does not depend on input data and
can be used for each segment in x, y, and z p
1 p3
p(u) = c0 + c1u + c2u2 + c3u3 p0 p2
Interpolation Matrix
p0 p2
3 3
p(u,v) = b (u ) b
i j (v ) p ij = u T
M I P M T
I v
i=o j =0
p(0) p(1)
p(0) p(1)
p(u) = c0+uc1+u2c2+u3c3
p(0) = p0 = c0
p(1) = p1 = c0+c1+c2+c3
" p 0 % "1 0 0 0%
$ ' $ '
$ p1 ' $1 1 1 1'
q= = c
$p'0 ' $0 1 0 0'
$ ' $ '
# p'1 & #0 1 2 3&
Solving, we find c=MHq where MH is the Hermite matrix
1 0 0 0
0
0 1 0
M H
=
3 3 2 1
2 2 1 1
p(u) = uTc =>
p(u) = uTMHq
Blending Polynomials
p(u) = uTMHq => p(u) = b(u)Tq
2 u 3 3 u 2 + 1 1 0 0 0
0 0 1 0
3 2
M =
2 u + 3u H
3 3 2 1
b(u ) = 3
u 2 u2 + u 2 2 1 1
3 2
u u
Although these functions are smooth, the Hermite form
is not used directly in Computer Graphics and CAD
because we usually have control points but not derivatives
A) Non-continuous
See page 585-587 in
B) C0-continuous Real-time Rendering,
3rd ed.
C) G1-continuous
D) C1-continuous
(C2-continuous)
Example
Here the p and q have the same tangents
at the ends of the segment but different
derivatives
Generate different
Hermite curves
This techniques is used
in drawing applications
Reflections should be at least C1
Bezier Curves
In graphics and CAD, we do not usually
have derivative data
Bezier suggested using the same 4 data
points as with the cubic interpolating curve
to approximate the derivatives in the
Hermite form
Approximating Derivatives
p1 p2
dp(u = 0) p1 p 0 p3 p 2
= p'(0) p' (1)
du 1/ 3 1/ 3
p0 p3
u
p1 p2
Equations
p0 p3
Interpolating conditions are the same p(u) = c0+uc1+u2c2+u3c3
p(0) = p0 = c0 p(u) = c1+2uc2+3u2c3
p(1) = p3 = c0+c1+c2+c3
Approximating derivative conditions
p1 p0
p ' ( 0)
1/ 3
p(0) = 3(p1- p0) = c1
p p p(1) = 3(p3- p2) = c1+2c2+3c3 Bp=Ac
p' (1) 3 2
1/ 3 c=A-1Bp
Solve four linear equations for c=MBp
Bezier Matrix
1 0 0 0
3 3 0 0
MB = 3 6 3
0
1 3 3 1
blending functions
p1 p2
Blending Functions
p0 p3
(1 u )3
2
3u (1 u )
b(u ) =
2 u 2 (1 u )
3
u
p0 p3
Bezier Patches 3 3
i j
p(u, v) = c ij u v
i =o j =0
Patch lies in
convex hull
Analysis
p0 p3
1 4 1 0
1 3 0 3 0
MS = 6 3 6 3 0
1 3 3 1
Blending Functions
3
(1 u )
2 3
1 4 6 u + 3u
b(u ) =
6 1 + 3u + 3 u 2 3 u3
3
u
p(u) = uTMSp = b(u)Tp =>
p(u) = b0(u)p0+ b1(u)p1+ b2(u)p2+ b3(u)p3
convex hull property
1 4 1 0
3 1 3 0 3 0
uT M S = 1 u u2 u
6 3 6 3 0
1 3 3 1
B-Spline Patches
3 3
i+1
4
p(u) = Bi(u) pi = B 0(u) p 0 +... B n1(u) p n1
In terms of the blending polynomials
0 u <i2 1
(u + 2) i 2 u < i 1
b0
b1 (u + 1) i 1 u < i
Bi (u ) = (u ) i u < i +1
b2
b3 (u 1) i +1 u < i + 2
0 u
0 u i+2
p0 p1 p2 p3 p4
p1
p2 p4
p0
p3
u
Weights for each point along the curve
One more example
1
p4 p0 p1 p2 p3 p4 p0
p1 p2
0 u u = 2.7
u = 2.7 p3
p0
u
u=0 1 2 3 4 5 6 7 8
u
SUMMARY
B-Splines
In each point p(u) of the curve, for a given u, the point is defined as a
weighted sum of the closest 4 surrounding points. Below are shown the
weights for each point along u=08
100 Blendfunction B1(u)
% for point p1
p0 p1 p2 p3 p4 p5 p6 p7 p8
The weight function (blend function) Bi (u) for a point pi can thus be written
as a translation of a basis function B(t). Bi(u) = Bt(u-i)
100%
B(t):
Our complete B-spline curve
p(u) can thus be written as:
t
p(u) = Bi(u) pi
-2 -1 0 1 2
Generalizing Splines
We can extend to splines of any degree
Data and conditions do not have to be
given at equally spaced values (the knots)
Nonuniform and uniform splines
Can have repeated knots
Easiest implemented by just repeating a ctrl point
Can force spline to interpolate points
(Cox-deBoor recursion gives method of evaluation (also
known as deCasteljau-recursion, see page 579, RTR 3:rd
Ed. for details)) DEMO of B-Spline
curve: (make
duplicate knots)
NURBS
Nonuniform Rational B-Spline curves and
surfaces add a fourth variable w to x,y,z
Can interpret as weight to give more
importance to some control data
Can also interpret as moving to homogeneous
coordinate
p(u) =
i=0
Bi (u)wi pi to make the combined weights sum
up to 1, at each position along the
n
i=0
Bi (u)wi curve. Otherwise, a translation of the
curve is introduced (which is not
desirable)
NURBS
Concider a control point in 3 dimensions:
pi = [xi , yi , zi ]
The weighted homogeneous-coordinate is:
xi
y
i
q i = wi
zi
1
The idea is to use the weights wi to increase or
decrease the importance of a particular control
point
NURBS
The w-component may not be equal to 1.
Thus we must do a perspective division to get
the three-dimensional points:
n
p(u ) =
1
q(u ) =
B w p(i)
i =0 i ,d i
n
w(u ) B w i ,d i
i =0