Upload
barnaby-andrews
View
220
Download
0
Embed Size (px)
Citation preview
104/21/23 15:09
Graphics II 91.547
Introduction to Parametric Curvesand Surfaces
Session 2
204/21/23 15:09
Computer GraphicsConceptual Model
ApplicationModel
ApplicationProgram Graphics
System
OutputDevices
InputDevices
API
Function Callsor Protocol
Data
304/21/23 15:09
404/21/23 15:09
Gouraud Shading:Use Mean Normal at Each Vertex
504/21/23 15:09
The Utah Teapot: 32 Bezier Patches
604/21/23 15:09
Explict Representation of Curve:Two Dimensions
y f (x)
x g(y)
DependentVariable
IndependentVariable
General case: Neither variable is a single-valued function of the other.Example: a circle centered at the origin
y r 2 x 2 y r 2 x 2
704/21/23 15:09
Explicit Representation of a Curve:Three Dimensions
y f (x) z g(x)
c
y
x
zPlane x = c
(y,z) (y(c), g(c))
804/21/23 15:09
Implicit Representation
f (x, y) 0Two Dimensions:
Should be thought of as a “membership” or “testing”function.
Divides space into points on the curve and not onthe curve.
Circle: x y r2 2 2 0
Describes a curve
Line: ax by c 0
904/21/23 15:09
Implicit Representation:Three Dimensions
f (x, y, z) 0 Defines a surface in three dimensions.
Example: a sphere of radius r at origin
x 2 y2 z 2 r 2 0
There is no easy way to represent a curveimplicitly in three dimensions.
Algebraic surfaces are those in which f is polynomialin x, y, z. Quadric surfaces are algebraic surfaceswhere the polynomial is of degree at most 2.
1004/21/23 15:09
Problems with Implicit Representation
0 Difficult to evaluate for rendering because identifying points on the curve requires explicit solution for (x,y).
0 Limited variety of curves that can be obtained.
1104/21/23 15:09
Parametric Representationof Curves and Surfaces
Express each spatial variable for points on the curve asa function of a non-spatial independent variable.
x x(u)
y y(u)
z z(u)
Parametric surfaces require two parameters:
x x(u,v)
y y(u,v)
z z(u,v)
Where u is defined over some closed range, e.g. [0, 1]
1204/21/23 15:09
What does a Parametric RepresentationReally Mean?
( , , )x y z1 1 1
( , , )x y z2 2 2
( , , )x y z3 3 3
( , , )x y z4 4 4
u1 u2 u3 u4
u
1304/21/23 15:09
Advantages of Parametric Representation
0 Solves problem of choice of independent variable0 Easy computation of derivatives0 Provides mechanism for “tracing” a curve or surface0 Facilitates joining of multiple curves, surfaces0 Generates a rich variety of curves, surfaces0 Ease of rendering
1404/21/23 15:09
Parametric Polynomial Curves
p( )
( )
( )
( )
u
x u
y u
z u
Defines points on a parametric curve.
A polynomial parametric curve of degree n is defined:
n
k
kkuu
0
)( cp
zk
yk
xk
k
c
c
c
c
1504/21/23 15:09
Parametric Polynomial Surfaces
p c( , )
( , )
( , )
( , )
u v
x u v
y u v
z u v
u vijj
m
i
ni j
00
0 1
0 1
u
v
u=1
v=1v=0
u=0
y
z
x
1604/21/23 15:09
Continuity Considerations
p(0)
p(1)q(0)
q(1)
C0 continuity: p(1) q(0)=
C1 continuity: p' (1) q' (0) p' ( )u
pup
upu
x
y
z
p' (1) kq' (0)G1 continuity:
1704/21/23 15:09
What degree do we want?
High order polynomials provide more control over shapeof curve. Degree n provides 3(n+1) degrees of freedom,in the choice of ck.
The higher the order of a polynomial, the less “smooth” it is.A polynomial of degre n can change directions n-1 times.
Consider polynomial oforder 5.
1804/21/23 15:09
Parametric Cubic Polynomial CurvesMatrix Notation
p(u) c 0 c1u c 2u2 c3u
3 c kk0
3
u k uT c
c
c
c
c
c
0
1
2
3
z
y
x
c
c
c
3
3
3
3c u
1
2
3
u
u
u
1904/21/23 15:09
Parametric Curves:How Do I Control the Shape?
2004/21/23 15:09
Interpolation:Four control points on curve
p0
p1 p2
p3u 0
u 1u 13 u 2
3
32103
33
32
22
32
132
032
2
33
31
22
31
131
031
1
00
)1(
)()()(
)()()(
)0(
ccccpp
ccccpp
ccccpp
cpp
This constraint can be expressed by the equations:
p(u) c 0 c1u c 2u2 c3u
3 c kk0
3
u k uT c
2104/21/23 15:09
Computing the coefficients
A
1 0 0 0
1
1
1 1 1 1
13
13
2 13
3
23
23
2 23
3
( ) ( )
( ) ( )
Expressing the constraints in matrix form:
Where:
p Ac
p
p
p
p
p
0
1
2
3
p Ac A 1p A 1Ac c
c
c
c
c
c
0
1
2
3
2204/21/23 15:09
Computing the coefficients
5.45.135.135.4
5.4185.229
15.495.5
0001
1A
pAc 1
2304/21/23 15:09
Blending Functions
p(u) c 0 c1u c 2u2 c3u
3 c kk0
3
u k uT c
Substituting from c A 1p gives: p(u) uT A 1p
which can be written as:
p(u) b(u)T p
where b(u) (A 1 )T u is a column vector of blending functions.
b( )
( )
( )
( )
( )
u
b u
b u
b u
b u
0
1
2
3
2404/21/23 15:09
Blending Functions
3
2
1
0
32
5.45.135.135.4
5.4185.229
15.495.5
0001
1
p
p
p
p
uuu
2504/21/23 15:09
Expressing a point on the curve in terms of theblending polynomials
p p p p p( ) ( ) ( ) ( ) ( )u b u b u b u b u 0 0 1 1 2 2 3 3
Control points @ u 0 u 13 u 2
3 u 1
2604/21/23 15:09
What the blending functions look like:
b u u u u
b u u u u
b u u u u
b u u u u
092
13
23
1272
23
2272
13
392
13
23
1
1
1
( ) ( )( )( )
( ) ( )( )
( ) ( )( )
( ) ( )( )
b(u) (A 1 )T u
2704/21/23 15:09
0 Contains scalars and polynomials (vectors)0 Addition, zero polynomial defined0 Can express a basis, e.g.
0 Representation of a polynomial in terms of this basis can be expressed as a column vector of scalar coefficients.
Let’s look at polynomials as a vector space.
1
2
3
u
u
u
2804/21/23 15:09
Conversion of representation fromone basis to another
Representation: c p
u bBasis:
1
2
3
u
u
u
92
13
23
272
23
272
13
92
13
23
1
1
1
( )( )( )
( )( )
( )( )
( )( )
u u u
u u u
u u u
u u u
c
c
c
c
0
1
2
3
p
p
p
p
0
1
2
3
2904/21/23 15:09
Conversion of representation fromone basis to another
Representation: c p
u bBasis:
c A p 1
b A u ( )1 T
The central issue in parametric curves (and surfaces) isthe selection of an appropriate basis for the controlpoint representation.
3004/21/23 15:09
How do we extend this to 3 dimensions? Interpolating Patch
p00
p30
p03
p33u = constant
v = constant
p13
p23
p01
p02 p11
p10
p20
p12
p22
p21
p31
p32
3104/21/23 15:09
Bicubic interpolating surface patch
p c( , )u v u vi j
jiij
0
3
0
3
1
1
12 3
2 3
2 2 2 2 2 3
3 3 3 2 3 3
2 3
2
3
v v v
u uv uv uv
u u v u v u v
u u v u v u v
u u uv
v
v
T
u v
16 coefficients allow the interpolation of 16 points.
3204/21/23 15:09
Solving for Coefficients
p u Cv( , )u v T
Substituting the values at 16 points: u v, , , ,0 113
23
Gives the equation: P ACA T Where
A
1 0 0 0
1
1
1 1 1 1
13
13
2 13
3
23
23
2 23
3
( ) ( )
( ) ( )as before
3304/21/23 15:09
Solving for Coefficients
A p A A CA
A p CA
C A p A
1 1
1
1 1
( )
( )
T
T
T
p u Cv u A p A v
p b pb
p
( , ) ( )
( , ) ( ) ( )
( , ) ( ) ( )
u v
u v u v
u v b u b v p
T T T
T
ij o
j
i
i
j ij
1 1
3
0
3
Note: separability of blending polynomial in u, v.
3404/21/23 15:09
Lines of constant u and v areInterpolating curves
p00
p30
p03
p33u = constant
v = constant