Professional Documents
Culture Documents
Stu Pomerantz
smp@psc.edu
http://www.psc.edu/~smp
December 8, 2004
a Mostmaterial is adapted from: OpenGL ARB, et. al, “The OpenGL Pro-
gramming Guide”, Third Ed., Reading: Addison-Wesley, 1999
1
2D Parametric Curves
x = x(u)
y = y(u)
Where u is the parameter that is free to vary. For example:
x = cos(θ)
y = sin(θ)
x and y will trace out a circle as 0 ≤ θ ≤ 2π .
222
2D Parametric Curves
223
2D Parametric Curves
x = cos(u+du) ; y = sin(u+du) ; z = 0 ;
glVertex3f(x,y,z) ;
}
glEnd() ;
224
3D Parametric Curves
x = x(u)
y = y(u)
z = z(u)
Where u is the parameter that is free to vary. For example:
x = cos(θ)
y = sin(θ)
z=θ
x, y and z will trace out a circlular helix as 0 ≤ θ ≤ 2π .
225
3D Parametric Curves
226
3D Parametric Curves
227
3D Parametric Surfaces
x = x(u, v)
y = y(u, v)
z = z(u, v)
Where u and v are the parameters that are free to vary. For
example:
x = cos(θ) sin(φ)
y = sin(θ) sin(φ)
z = cos(φ)
x, y and z will trace out a sphere as 0 ≤ θ ≤ 2π and 0 ≤ φ ≤ 2π .
228
3D Parametric Surfaces
229
Polynomial Parametric Curves
n
X
p~(u) = uk~c k
k=0
where
cxk
k
~c = cyk
czk
230
Polynomial Parametric Curves
For example if n = 3,
3
X
p~(u) = uk~c k
k=0
expands to:
cx3 cx2 cx1 cx0
3
2
+ u cy2 + u cy1 + cy0
p~(u) = u cy3
231
Polynomial Parametric Curves
Continuing,
cx3 cx2 cx1 cx0
3
2
p~(u) = u cy3 + u cy2 + u cy1 + cy0
cz3 cz2 cz1 cz0
expands to
232
Polynomial Parametric Surfaces
x(u, v) n X m
X i j
p~(u, v) =
y(u, v) =
~
c ij u v
i=0 j=0
z(u, v)
233
Interpolation Revisited
Two points, p~0 and p~1 , can be linearly interpolated like this:
p~ = a p~0 + (1 − a) p~1
where a ∈ [0, 1]
In this context, interpolation is also called blending. The points are
mixed together by the a and 1 − a which are weights.
The points p~0 and p~1 can be thought of as control points since they
influence (constrain) the final interpolated value.
This is similar, but not identical to, OpenGL’s blending functions.
And, in this case the purpose is not to produce transparent
surfaces but rather to produce a new interpolated point.
234
Interpolation using Cubic Polynomials
k=0
235
Interpolation using Cubic Polynomials
m11 m12 m13 m14 g1x g1y g1z
m21 m22 m23 m24
¤ g g2y g2z
£ 3 2 2x
u u u 1 · ·
m31 m32 m33 m34 g3x g3y g3z
m41 m42 m43 m44 g4x g4y g4z
Or more briefly,
p~(u) = U · M · G
236
Interpolation using Cubic Polynomials
For example,
237
Interpolation using Cubic Polynomials
238
The Hermite Basis
239
The Hermite Basis
Recall,
£ 3 2
¤
U= u u u1
so,
0
£ 2
¤
U = 3u 2u 1 0
p~1 = [0 0 0 1] (u = 0)
p~4 = [1 1 1 1] (u = 1)
p~2 = [0 0 1 0] (u0 = 0)
p~3 = [3 2 1 0] (u0 = 1)
240
The Hermite Basis
p~1 0 0 0 1
p~ 1 1 1 1
4
=
p~2 0 0 1 0
p~3 3 2 1 0
241
The Hermite Basis
2 −2 1 1
−3 3 −2 −1
M =
0 0 1 0
1 0 0 0
So,
242
The Hermite Basis
243
Example Hermite Curves
244
Comparison of Curve Types
245
Example NURBS Surface
246