SlideShare a Scribd company logo
1 of 79
Curves and Surfaces
Ed Angel
Professor of Computer Science,
Electrical and Computer
Engineering, and Media Arts
University of New Mexico
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
2
Objectives
• Introduce types of curves and surfaces
– Explicit
– Implicit
– Parametric
– Strengths and weaknesses
• Discuss Modeling and Approximations
– Conditions
– Stability
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
3
Escaping Flatland
• Until now we have worked with flat entities
such as lines and flat polygons
– Fit well with graphics hardware
– Mathematically simple
• But the world is not composed of flat
entities
– Need curves and curved surfaces
– May only have need at the application level
– Implementation can render them
approximately with flat primitives
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
4
Modeling with Curves
data points
approximating curve
interpolating data point
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
5
What Makes a Good
Representation?
• There are many ways to represent curves
and surfaces
• Want a representation that is
– Stable
– Smooth
– Easy to evaluate
– Must we interpolate or can we just come close to
data?
– Do we need derivatives?
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
6
Explicit Representation
• Most familiar form of curve in 2D
y=f(x)
• Cannot represent all curves
– Vertical lines
– Circles
• Extension to 3D
– y=f(x), z=g(x)
– The form z = f(x,y) defines a surface
x
y
x
y
z
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
7
Implicit Representation
• Two dimensional curve(s)
g(x,y)=0
• Much more robust
– All lines ax+by+c=0
– Circles x2+y2-r2=0
• Three dimensions g(x,y,z)=0 defines a surface
– Intersect two surface to get a curve
• In general, we cannot solve for points that satisfy
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
8
Algebraic Surface
0

 z
y
x
k
j
i j k
i
•Quadric surface 2  i+j+k
•At most 10 terms
•Can solve intersection with a ray by
reducing problem to solving quadratic equation
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
9
Parametric Curves
• Separate equation for each spatial variable
x=x(u)
y=y(u)
z=z(u)
• For umax  u  umin we trace out a curve in two
or three dimensions
p(u)=[x(u), y(u), z(u)]T
p(u)
p(umin)
p(umax)
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
10
Selecting Functions
• Usually we can select “good” functions
– not unique for a given spatial curve
– Approximate or interpolate known data
– Want functions which are easy to evaluate
– Want functions which are easy to differentiate
• Computation of normals
• Connecting pieces (segments)
– Want functions which are smooth
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
11
Parametric Lines
Line connecting two points p0 and p1
p(u)=(1-u)p0+up1
We can normalize u to be over the interval (0,1)
p(0) = p0
p(1)= p1
Ray from p0 in the direction d
p(u)=p0+ud
p(0) = p0
p(1)= p0 +d
d
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
12
Parametric Surfaces
• Surfaces require 2 parameters
x=x(u,v)
y=y(u,v)
z=z(u,v)
p(u,v) = [x(u,v), y(u,v), z(u,v)]T
• Want same properties as curves:
– Smoothness
– Differentiability
– Ease of evaluation
x
y
z p(u,0)
p(1,v)
p(0,v)
p(u,1)
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
13
Normals
We can differentiate with respect to u and v to
obtain the normal at any point p



















u
v
u
u
v
u
u
v
u
u
v
u
/
)
,
(
z
/
)
,
(
y
/
)
,
(
x
)
,
(
p



















v
v
u
v
v
u
v
v
u
v
v
u
/
)
,
(
z
/
)
,
(
y
/
)
,
(
x
)
,
(
p
v
v
u
u
v
u






)
,
(
)
,
( p
p
n
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
14
Parametric Planes
point-vector form
p(u,v)=p0+uq+vr
n = q x r
q
r
p0
n
three-point form
p0
n
p1
p2
q = p1 – p0
r = p2 – p0
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
15
Parametric Sphere
x(u,v) = r cos q sin f
y(u,v) = r sin q sin f
z(u,v) = r cos f
360  q  0
180  f  0
q constant: circles of constant longitude
f constant: circles of constant latitude
differentiate to show n = p
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
16
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)
q(u)
p(0)
q(1)
join point p(1) = q(0)
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
17
Parametric Polynomial Curves
u
c
u
x i
N
i
xi



0
)
( u
c
u
y j
M
j
yj



0
)
( u
c
u
z k
L
k
zk



0
)
(
•If N=M=K, we need to determine 3(N+1) coefficients
•Equivalently we need 3(N+1) independent conditions
•Noting that the curves for x, y and z are independent,
we can define each independently in an identical manner
•We will use the form
where p can be any of x, y, z
u
c
u k
L
k
k



0
)
(
p
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
18
Why Polynomials
• Easy to evaluate
• Continuous and differentiable
everywhere
– Must worry about continuity at join points
including continuity of derivatives
p(u)
q(u)
join point p(1) = q(0)
but p’(1)  q’(0)
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
19
Cubic Parametric Polynomials
• N=M=L=3, gives balance between ease of evaluation and
flexibility in design
• Four coefficients to determine for each of x, y and z
• Seek four independent conditions for various values of u
resulting in 4 equations in 4 unknowns for each of x, y and z
– Conditions are a mixture of continuity requirements at
the join points and conditions for fitting the data
u
c
u k
k
k



3
0
)
(
p
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
20
Cubic Polynomial Surfaces
v
u
c
v
u j
i
i j
ij

 

3
0
3
0
)
,
(
p
p(u,v)=[x(u,v), y(u,v), z(u,v)]T
where
p is any of x, y or z
Need 48 coefficients ( 3 independent sets of 16) to
determine a surface patch
Designing Parametric Cubic
Curves
Ed Angel
Professor of Computer Science,
Electrical and Computer
Engineering, and Media Arts
University of New Mexico
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
22
Objectives
• Introduce the types of curves
– Interpolating
– Hermite
– Bezier
– B-spline
• Analyze their performance
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
23
Matrix-Vector Form
u
c
u k
k
k



3
0
)
(
p













c
c
c
c
3
2
1
0
c













u
u
u
3
2
1
u
define
u
c
c
u
T
T
u 

)
(
p
then
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
24
Interpolating Curve
p0
p1
p2
p3
Given four data (control) points p0 , p1 ,p2 , p3
determine cubic p(u) which passes through them
Must find c0 ,c1 ,c2 , c3
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
25
Interpolation Equations
apply the interpolating conditions at u=0, 1/3, 2/3, 1
p0=p(0)=c0
p1=p(1/3)=c0+(1/3)c1+(1/3)2c2+(1/3)3c2
p2=p(2/3)=c0+(2/3)c1+(2/3)2c2+(2/3)3c2
p3=p(1)=c0+c1+c2+c2
or in matrix form with p = [p0 p1 p2 p3]T
p=Ac























































1
1
1
1
3
2
3
2
3
2
1
3
1
3
1
3
1
1
0
0
0
1
3
2
3
2
A
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
26
Interpolation Matrix
Solving for c we find the interpolation matrix





















5
.
4
5
.
13
5
.
13
5
.
4
5
.
4
18
5
.
22
9
1
5
.
4
9
5
.
5
0
0
0
1
1
A
MI
c=MIp
Note that MI does not depend on input data and
can be used for each segment in x, y, and z
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
27
Interpolating Multiple Segments
use p = [p0 p1 p2 p3]T use p = [p3 p4 p5 p6]T
Get continuity at join points but not
continuity of derivatives
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
28
Blending Functions
Rewriting the equation for p(u)
p(u)=uTc=uTMIp = b(u)Tp
where b(u) = [b0(u) b1(u) b2(u) b3(u)]T is
an array of blending polynomials such that
p(u) = b0(u)p0+ b1(u)p1+ b2(u)p2+ b3(u)p3
b0(u) = -4.5(u-1/3)(u-2/3)(u-1)
b1(u) = 13.5u (u-2/3)(u-1)
b2(u) = -13.5u (u-1/3)(u-1)
b3(u) = 4.5u (u-1/3)(u-2/3)
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
29
Blending Functions
• These functions are not smooth
– Hence the interpolation polynomial is not
smooth
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
30
Interpolating Patch
v
u
c
v
u
p j
j
ij
i
o
i

 


3
0
3
)
,
(
Need 16 conditions to determine the 16 coefficients cij
Choose at u,v = 0, 1/3, 2/3, 1
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
31
Matrix Form
Define v = [1 v v2 v3]T
C = [cij] P = [pij]
p(u,v) = uTCv
If we observe that for constant u (v), we obtain
interpolating curve in v (u), we can show
p(u,v) = uTMIPMI
Tv
C=MIPMI
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
32
Blending Patches
p
v
b
u
b
v
u
p ij
j
j
i
o
i
)
(
)
(
)
,
(
3
0
3

 


Each bi(u)bj(v) is a blending patch
Shows that we can build and analyze surfaces
from our knowledge of curves
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
33
Other Types of Curves and Surfaces
• How can we get around the limitations
of the interpolating form
– Lack of smoothness
– Discontinuous derivatives at join points
• We have four conditions (for cubics)
that we can apply to each segment
– Use them other than for interpolation
– Need only come close to the data
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
34
Hermite Form
p(0) p(1)
p’(0) p’(1)
Use two interpolating conditions and
two derivative conditions per segment
Ensures continuity and first derivative
continuity between segments
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
35
Equations
Interpolating conditions are the same at ends
p(0) = p0 = c0
p(1) = p3 = c0+c1+c2+c3
Differentiating we find p’(u) = c1+2uc2+3u2c3
Evaluating at end points
p’(0) = p’0 = c1
p’(1) = p’3 = c1+2c2+3c3
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
36
Matrix Form
c
q


























3
2
1
0
0
0
1
0
1
1
1
1
0
0
0
1
p'
p'
p
p
3
0
3
0
Solving, we find c=MHq where MH is the Hermite matrix

















1
1
2
2
1
2
3
3
0
1
0
0
0
0
0
1
MH
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
37
Blending Polynomials
p(u) = b(u)Tq




















u
u
u
u
u
u
u
u
u
u
2
3
2
3
2
3
2
3
2
3
2
1
3
2
)
(
b
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
However, the Hermite form is the basis of the Bezier form
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
38
Parametric and Geometric Continuity
• We can require the derivatives of x, y,and z to
each be continuous at join points (parametric
continuity)
• Alternately, we can only require that the
tangents of the resulting curve be continuous
(geometry continuity)
• The latter gives more flexibility as we have
need satisfy only two conditions rather than
three at each join point
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
39
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
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
40
Higher Dimensional Approximations
• The techniques for both interpolating and
Hermite curves can be used with higher
dimensional parametric polynomials
• For interpolating form, the resulting matrix
becomes increasingly more ill-conditioned and
the resulting curves less smooth and more
prone to numerical errors
• In both cases, there is more work in rendering
the resulting polynomial curves and surfaces
Bezier and Spline Curves and
Surfaces
Ed Angel
Professor of Computer Science,
Electrical and Computer
Engineering, and Media Arts
University of New Mexico
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
42
Objectives
• Introduce the Bezier curves and
surfaces
• Derive the required matrices
• Introduce the B-spline and compare it to
the standard cubic Bezier
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
43
Bezier’s Idea
• 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
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
44
Approximating Derivatives
p0
p1
p2
p3
p1 located at u=1/3 p2 located at u=2/3
3
/
1
p
p
)
0
(
'
p 0
1 

3
/
1
p
p
)
1
(
'
p 2
3 

slope p’(0) slope p’(1)
u
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
45
Equations
p(0) = p0 = c0
p(1) = p3 = c0+c1+c2+c3
p’(0) = 3(p1- p0) = c0
p’(1) = 3(p3- p2) = c1+2c2+3c3
Interpolating conditions are the same
Approximating derivative conditions
Solve four linear equations for c=MBp
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
46
Bezier Matrix

















1
3
3
1
0
3
6
3
0
0
3
3
0
0
0
1
MB
p(u) = uTMBp = b(u)Tp
blending functions
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
47
Blending Functions


















u
u
u
u
u
u
u
3
2
2
3
)
1
(
2
)
1
(
3
)
1
(
)
(
b
Note that all zeros are at 0 and 1 which forces
the functions to be smooth over (0,1)
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
48
Bernstein Polynomials
• The blending functions are a special case of
the Bernstein polynomials
• These polynomials give the blending
polynomials for any degree Bezier form
– All zeros at 0 and 1
– For any degree they all sum to 1
– They are all between 0 and 1 inside (0,1)
)
1
(
)!
(
!
!
)
(
kd u
u
k
d
k
d
u
b
k
d
k


 
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
49
Convex Hull Property
• The properties of the Bernstein polynomials
ensure that all Bezier curves lie in the convex
hull of their control points
• Hence, even though we do not interpolate all
the data, we cannot be too far away
p0
p1 p2
p3
convex hull
Bezier curve
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
50
Bezier Patches
Using same data array P=[pij] as with interpolating form
v
u
p
v
b
u
b
v
u
p T
B
B
T
ij
j
i j
i M
P
M

 
 
)
(
)
(
)
,
(
3
0
3
0
Patch lies in
convex hull
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
51
Analysis
• Although the Bezier form is much better than
the interpolating form, we have the derivatives
are not continuous at join points
• Can we do better?
– Go to higher order Bezier
• More work
• Derivative continuity still only approximate
• Supported by OpenGL
–Apply different conditions
• Tricky without letting order increase
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
52
B-Splines
• Basis splines: use the data at p=[pi-2 pi-1 pi pi-1]T to
define curve only between pi-1 and pi
• Allows us to apply more continuity conditions to each
segment
• For cubics, we can have continuity of function, first
and second derivatives at join points
• Cost is 3 times as much work for curves
– Add one new point each time rather than three
• For surfaces, we do 9 times as much work
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
53
Cubic B-spline

















1
3
3
1
0
3
6
3
0
3
0
3
0
1
4
1
MS
p(u) = uTMSp = b(u)Tp
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
54
Blending Functions





















u
u
u
u
u
u
u
u
3
2
2
3
2
3
3
3
3
1
3
6
4
)
1
(
6
1
)
(
b
convex hull property
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
55
B-Spline Patches
v
u
p
v
b
u
b
v
u
p T
S
S
T
ij
j
i j
i M
P
M

 
 
)
(
)
(
)
,
(
3
0
3
0
defined over only 1/9 of region
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
56
Splines and Basis
• If we examine the cubic B-spline from the
perspective of each control (data) point, each
interior point contributes (through the blending
functions) to four segments
• We can rewrite p(u) in terms of the data points
as
defining the basis functions {Bi(u)}
p
u
B
u
p i
i )
(
)
( 

Angel: Interactive Computer
Graphics 3E © Addison-Wesley
57
Basis Functions
2
2
1
1
1
1
2
2
0
)
1
(
)
(
)
1
(
)
2
(
0
)
(
3
2
1
0































i
u
i
u
i
i
u
i
i
u
i
i
u
i
i
u
u
b
u
b
u
b
u
b
u
Bi
In terms of the blending polynomials
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
58
Generalizing Splines
• We can extend to splines of any degree
• Data and conditions to not have to given at
equally spaced values (the knots)
– Nonuniform and uniform splines
– Can have repeated knots
• Can force spline to interpolate points
• Cox-deBoor recursion gives method of
evaluation
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
59
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
• Requires a perspective division
– NURBS act correctly for perspective viewing
• Quadrics are a special case of NURBS
Rendering Curves and
Surfaces
Ed Angel
Professor of Computer Science,
Electrical and Computer
Engineering, and Media Arts
University of New Mexico
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
61
Objectives
• Introduce methods to draw curves
– Approximate with lines
– Finite Differences
• Derive the recursive method for
evaluation of Bezier curves and
surfaces
• Learn how to convert all polynomial
data to data for Bezier polynomials
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
62
Evaluating Polynomials
• Simplest method to render a polynomial curve
is to evaluate the polynomial at many points
and form an approximating polyline
• For surfaces we can form an approximating
mesh of triangles or quadrilaterals
• Use Horner’s method to evaluate polynomials
p(u)=c0+u(c1+u(c2+uc3))
– 3 multiplications/evaluation for cubic
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
63
Finite Differences
)
(
)
(
)
0
(
uk
p
uk
p 

)
(
)
1
(
)
(
)
1
(
uk
p
uk
p
uk
p 



)
(
)
1
(
)
( )
(
)
(
)
1
(
uk
p
uk
p
uk
p m
m
m





 
For equally spaced {uk} we define finite differences
For a polynomial of degree n,
the nth finite difference is constant
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
64
Building a Finite Difference Table
p(u)=1+3u+2u2+u3
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
65
Finding the Next Values
Starting at the bottom, we can work up
generating new values for the
polynomial
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
66
deCasteljau Recursion
• We can use the convex hull property of
Bezier curves to obtain an efficient recursive
method that does not require any function
evaluations
– Uses only the values at the control points
• Based on the idea that “any polynomial and
any part of a polynomial is a Bezier
polynomial for properly chosen control data”
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
67
Splitting a Cubic Bezier
p0, p1 , p2 , p3 determine a cubic Bezier polynomial
and its convex hull
Consider left half l(u) and right half r(u)
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
68
l(u) and r(u)
Since l(u) and r(u) are Bezier curves, we should be able to
find two sets of control points {l0, l1, l2, l3} and {r0, r1, r2, r3}
that determine them
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
69
Convex Hulls
{l0, l1, l2, l3} and {r0, r1, r2, r3}each have a convex hull that
that is closer to p(u) than the convex hull of {p0, p1, p2, p3}
This is known as the variation diminishing property.
The polyline from l0 to l3 (= r0) to r3 is an approximation
to p(u). Repeating recursively we get better approximations.
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
70
Equations
Start with Bezier equations p(u)=uTMBp
l(u) must interpolate p(0) and p(1/2)
l(0) = l0 = p0
l(1) = l3 = p(1/2) = 1/8( p0 +3 p1 +3 p2 + p3 )
Matching slopes, taking into account that l(u) and r(u)
only go over half the distance as p(u)
l’(0) = 3(l1 - l0) = p’(0) = 3/2(p1 - p0 )
l’(1) = 3(l3 – l2) = p’(1/2) = 3/8(- p0 - p1+ p2 + p3)
Symmetric equations hold for r(u)
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
71
Efficient Form
l0 = p0
r3 = p3
l1 = ½(p0 + p1)
r1 = ½(p2 + p3)
l2 = ½(l1 + ½( p1 + p2))
r1 = ½(r2 + ½( p1 + p2))
l3 = r0 = ½(l2 + r1)
Requires only shifts and adds!
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
72
Every Curve is a Bezier Curve
• We can render a given polynomial using the
recursive method if we find control points for
its representation as a Bezier curve
• Suppose that p(u) is given as an interpolating
curve with control points q
• There exist Bezier control points p such that
• Equating and solving, we find p=MB
-1MI
p(u)=uTMIq
p(u)=uTMBp
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
73
Matrices
Interpolating to Bezier
B-Spline to Bezier






















1
0
0
0
6
5
3
2
3
3
1
3
1
2
3
3
6
5
0
0
0
1
1
M
M I
B














1
4
1
0
0
4
2
0
0
2
4
0
0
1
4
1
1
M
M S
B
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
74
Example
These three curves were all generated from the same
original data using Bezier recursion by converting all
control point data to Bezier control points
Bezier Interpolating B Spline
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
75
Surfaces
• Can apply the recursive method to surfaces if
we recall that for a Bezier patch curves of
constant u (or v) are Bezier curves in u (or v)
• First subdivide in u
– Process creates new points
– Some of the original points are discarded
original and kept new
original and discarded
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
76
Second Subdivision
16 final points for
1 of 4 patches created
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
77
Normals
• For rendering we need the normals if we want
to shade
– Can compute from parametric equations
– Can use vertices of corner points to determine
– OpenGL can compute automatically
v
v
u
u
v
u






)
,
(
)
,
( p
p
n
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
78
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
Angel: Interactive Computer
Graphics 3E © Addison-Wesley
79
Quadrics
• Any quadric can be written as the quadratic form
pTAp+bTp+c=0 where p=[x, y, z]T
with A, b and c giving the coefficients
• Render by ray casting
– Intersect with parametric ray p(a)=p0+ad that
passes through a pixel
– Yields a scalar quadratic equation
• No solution: ray misses quadric
• One solution: ray tangent to quadric
• Two solutions: entry and exit points

More Related Content

Similar to Lecture6.orig.ppt

Computer graphics notes 2 tutorials duniya
Computer graphics notes 2   tutorials duniyaComputer graphics notes 2   tutorials duniya
Computer graphics notes 2 tutorials duniyaTutorialsDuniya.com
 
Metric dimesion of circulsnt graphs
Metric dimesion of circulsnt graphsMetric dimesion of circulsnt graphs
Metric dimesion of circulsnt graphsAmna Abunamous
 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygonsaa11bb11
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons dericationKumar
 
Neural Collaborative Subspace Clustering
Neural Collaborative Subspace ClusteringNeural Collaborative Subspace Clustering
Neural Collaborative Subspace ClusteringTakahiro Hasegawa
 
DimensionalityReduction.pptx
DimensionalityReduction.pptxDimensionalityReduction.pptx
DimensionalityReduction.pptx36rajneekant
 
parameterized complexity for graph Motif
parameterized complexity for graph Motifparameterized complexity for graph Motif
parameterized complexity for graph MotifAMR koura
 
Implicit Interpolation Analytical Curves
Implicit Interpolation Analytical CurvesImplicit Interpolation Analytical Curves
Implicit Interpolation Analytical CurvesSharath Kumar
 
2-Vector.pptx
2-Vector.pptx2-Vector.pptx
2-Vector.pptxssfasf
 
4tocontest
4tocontest4tocontest
4tocontestberthin
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1aravindangc
 

Similar to Lecture6.orig.ppt (20)

Geometric model & curve
Geometric model & curveGeometric model & curve
Geometric model & curve
 
Computer graphics notes 2 tutorials duniya
Computer graphics notes 2   tutorials duniyaComputer graphics notes 2   tutorials duniya
Computer graphics notes 2 tutorials duniya
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
 
Metric dimesion of circulsnt graphs
Metric dimesion of circulsnt graphsMetric dimesion of circulsnt graphs
Metric dimesion of circulsnt graphs
 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygons
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons derication
 
Neural Collaborative Subspace Clustering
Neural Collaborative Subspace ClusteringNeural Collaborative Subspace Clustering
Neural Collaborative Subspace Clustering
 
DimensionalityReduction.pptx
DimensionalityReduction.pptxDimensionalityReduction.pptx
DimensionalityReduction.pptx
 
parameterized complexity for graph Motif
parameterized complexity for graph Motifparameterized complexity for graph Motif
parameterized complexity for graph Motif
 
Implicit Interpolation Analytical Curves
Implicit Interpolation Analytical CurvesImplicit Interpolation Analytical Curves
Implicit Interpolation Analytical Curves
 
Curve Fitting
Curve FittingCurve Fitting
Curve Fitting
 
Visual Techniques
Visual TechniquesVisual Techniques
Visual Techniques
 
2-Vector.pptx
2-Vector.pptx2-Vector.pptx
2-Vector.pptx
 
Lec15 sfm
Lec15 sfmLec15 sfm
Lec15 sfm
 
4tocontest
4tocontest4tocontest
4tocontest
 
Primitives
PrimitivesPrimitives
Primitives
 
Líneas rectas (slide share)
Líneas rectas (slide share)Líneas rectas (slide share)
Líneas rectas (slide share)
 
Networking Assignment Help
Networking Assignment HelpNetworking Assignment Help
Networking Assignment Help
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
 

More from Khalil Alhatab

LE03 The silicon substrate and adding to itPart 2.pptx
LE03 The silicon substrate and adding to itPart 2.pptxLE03 The silicon substrate and adding to itPart 2.pptx
LE03 The silicon substrate and adding to itPart 2.pptxKhalil Alhatab
 
Design Optimization.ppt
Design Optimization.pptDesign Optimization.ppt
Design Optimization.pptKhalil Alhatab
 
Lecture 4 MACHINE TOOL DRIVES.pptx
Lecture 4 MACHINE TOOL DRIVES.pptxLecture 4 MACHINE TOOL DRIVES.pptx
Lecture 4 MACHINE TOOL DRIVES.pptxKhalil Alhatab
 
89-metrology-and-measurements.ppt
89-metrology-and-measurements.ppt89-metrology-and-measurements.ppt
89-metrology-and-measurements.pptKhalil Alhatab
 
vvvvvvvvvvvvvvvchapter-1-190110110813.pdf
vvvvvvvvvvvvvvvchapter-1-190110110813.pdfvvvvvvvvvvvvvvvchapter-1-190110110813.pdf
vvvvvvvvvvvvvvvchapter-1-190110110813.pdfKhalil Alhatab
 
Chapter - 1 Basic Concepts.pdf
Chapter - 1 Basic Concepts.pdfChapter - 1 Basic Concepts.pdf
Chapter - 1 Basic Concepts.pdfKhalil Alhatab
 
15723120156. Measurement of Force and Torque.pdf
15723120156. Measurement of Force and Torque.pdf15723120156. Measurement of Force and Torque.pdf
15723120156. Measurement of Force and Torque.pdfKhalil Alhatab
 
3141901-chapter-1_introduction-to-metrology-linear-and-angular-measurement.pdf
3141901-chapter-1_introduction-to-metrology-linear-and-angular-measurement.pdf3141901-chapter-1_introduction-to-metrology-linear-and-angular-measurement.pdf
3141901-chapter-1_introduction-to-metrology-linear-and-angular-measurement.pdfKhalil Alhatab
 
15694598371.Measurment.pdf
15694598371.Measurment.pdf15694598371.Measurment.pdf
15694598371.Measurment.pdfKhalil Alhatab
 
Chapter 4 Angular Measurement.pdf
Chapter 4 Angular Measurement.pdfChapter 4 Angular Measurement.pdf
Chapter 4 Angular Measurement.pdfKhalil Alhatab
 

More from Khalil Alhatab (20)

LE03 The silicon substrate and adding to itPart 2.pptx
LE03 The silicon substrate and adding to itPart 2.pptxLE03 The silicon substrate and adding to itPart 2.pptx
LE03 The silicon substrate and adding to itPart 2.pptx
 
lecture7.ppt
lecture7.pptlecture7.ppt
lecture7.ppt
 
Design Optimization.ppt
Design Optimization.pptDesign Optimization.ppt
Design Optimization.ppt
 
Lecture 4 MACHINE TOOL DRIVES.pptx
Lecture 4 MACHINE TOOL DRIVES.pptxLecture 4 MACHINE TOOL DRIVES.pptx
Lecture 4 MACHINE TOOL DRIVES.pptx
 
ch01.pdf
ch01.pdfch01.pdf
ch01.pdf
 
L-031.pdf
L-031.pdfL-031.pdf
L-031.pdf
 
Part_1a.ppt
Part_1a.pptPart_1a.ppt
Part_1a.ppt
 
Lecture 3.pdf
Lecture 3.pdfLecture 3.pdf
Lecture 3.pdf
 
Lecture 3.pdf
Lecture 3.pdfLecture 3.pdf
Lecture 3.pdf
 
89-metrology-and-measurements.ppt
89-metrology-and-measurements.ppt89-metrology-and-measurements.ppt
89-metrology-and-measurements.ppt
 
vvvvvvvvvvvvvvvchapter-1-190110110813.pdf
vvvvvvvvvvvvvvvchapter-1-190110110813.pdfvvvvvvvvvvvvvvvchapter-1-190110110813.pdf
vvvvvvvvvvvvvvvchapter-1-190110110813.pdf
 
section1.1.pdf
section1.1.pdfsection1.1.pdf
section1.1.pdf
 
Chapter - 1 Basic Concepts.pdf
Chapter - 1 Basic Concepts.pdfChapter - 1 Basic Concepts.pdf
Chapter - 1 Basic Concepts.pdf
 
METRO20152_CH3.pdf
METRO20152_CH3.pdfMETRO20152_CH3.pdf
METRO20152_CH3.pdf
 
15723120156. Measurement of Force and Torque.pdf
15723120156. Measurement of Force and Torque.pdf15723120156. Measurement of Force and Torque.pdf
15723120156. Measurement of Force and Torque.pdf
 
3141901-chapter-1_introduction-to-metrology-linear-and-angular-measurement.pdf
3141901-chapter-1_introduction-to-metrology-linear-and-angular-measurement.pdf3141901-chapter-1_introduction-to-metrology-linear-and-angular-measurement.pdf
3141901-chapter-1_introduction-to-metrology-linear-and-angular-measurement.pdf
 
99995204.pdf
99995204.pdf99995204.pdf
99995204.pdf
 
6570550.ppt
6570550.ppt6570550.ppt
6570550.ppt
 
15694598371.Measurment.pdf
15694598371.Measurment.pdf15694598371.Measurment.pdf
15694598371.Measurment.pdf
 
Chapter 4 Angular Measurement.pdf
Chapter 4 Angular Measurement.pdfChapter 4 Angular Measurement.pdf
Chapter 4 Angular Measurement.pdf
 

Recently uploaded

MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 

Recently uploaded (20)

MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 

Lecture6.orig.ppt

  • 1. Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico
  • 2. Angel: Interactive Computer Graphics 3E © Addison-Wesley 2 Objectives • Introduce types of curves and surfaces – Explicit – Implicit – Parametric – Strengths and weaknesses • Discuss Modeling and Approximations – Conditions – Stability
  • 3. Angel: Interactive Computer Graphics 3E © Addison-Wesley 3 Escaping Flatland • Until now we have worked with flat entities such as lines and flat polygons – Fit well with graphics hardware – Mathematically simple • But the world is not composed of flat entities – Need curves and curved surfaces – May only have need at the application level – Implementation can render them approximately with flat primitives
  • 4. Angel: Interactive Computer Graphics 3E © Addison-Wesley 4 Modeling with Curves data points approximating curve interpolating data point
  • 5. Angel: Interactive Computer Graphics 3E © Addison-Wesley 5 What Makes a Good Representation? • There are many ways to represent curves and surfaces • Want a representation that is – Stable – Smooth – Easy to evaluate – Must we interpolate or can we just come close to data? – Do we need derivatives?
  • 6. Angel: Interactive Computer Graphics 3E © Addison-Wesley 6 Explicit Representation • Most familiar form of curve in 2D y=f(x) • Cannot represent all curves – Vertical lines – Circles • Extension to 3D – y=f(x), z=g(x) – The form z = f(x,y) defines a surface x y x y z
  • 7. Angel: Interactive Computer Graphics 3E © Addison-Wesley 7 Implicit Representation • Two dimensional curve(s) g(x,y)=0 • Much more robust – All lines ax+by+c=0 – Circles x2+y2-r2=0 • Three dimensions g(x,y,z)=0 defines a surface – Intersect two surface to get a curve • In general, we cannot solve for points that satisfy
  • 8. Angel: Interactive Computer Graphics 3E © Addison-Wesley 8 Algebraic Surface 0   z y x k j i j k i •Quadric surface 2  i+j+k •At most 10 terms •Can solve intersection with a ray by reducing problem to solving quadratic equation
  • 9. Angel: Interactive Computer Graphics 3E © Addison-Wesley 9 Parametric Curves • Separate equation for each spatial variable x=x(u) y=y(u) z=z(u) • For umax  u  umin we trace out a curve in two or three dimensions p(u)=[x(u), y(u), z(u)]T p(u) p(umin) p(umax)
  • 10. Angel: Interactive Computer Graphics 3E © Addison-Wesley 10 Selecting Functions • Usually we can select “good” functions – not unique for a given spatial curve – Approximate or interpolate known data – Want functions which are easy to evaluate – Want functions which are easy to differentiate • Computation of normals • Connecting pieces (segments) – Want functions which are smooth
  • 11. Angel: Interactive Computer Graphics 3E © Addison-Wesley 11 Parametric Lines Line connecting two points p0 and p1 p(u)=(1-u)p0+up1 We can normalize u to be over the interval (0,1) p(0) = p0 p(1)= p1 Ray from p0 in the direction d p(u)=p0+ud p(0) = p0 p(1)= p0 +d d
  • 12. Angel: Interactive Computer Graphics 3E © Addison-Wesley 12 Parametric Surfaces • Surfaces require 2 parameters x=x(u,v) y=y(u,v) z=z(u,v) p(u,v) = [x(u,v), y(u,v), z(u,v)]T • Want same properties as curves: – Smoothness – Differentiability – Ease of evaluation x y z p(u,0) p(1,v) p(0,v) p(u,1)
  • 13. Angel: Interactive Computer Graphics 3E © Addison-Wesley 13 Normals We can differentiate with respect to u and v to obtain the normal at any point p                    u v u u v u u v u u v u / ) , ( z / ) , ( y / ) , ( x ) , ( p                    v v u v v u v v u v v u / ) , ( z / ) , ( y / ) , ( x ) , ( p v v u u v u       ) , ( ) , ( p p n
  • 14. Angel: Interactive Computer Graphics 3E © Addison-Wesley 14 Parametric Planes point-vector form p(u,v)=p0+uq+vr n = q x r q r p0 n three-point form p0 n p1 p2 q = p1 – p0 r = p2 – p0
  • 15. Angel: Interactive Computer Graphics 3E © Addison-Wesley 15 Parametric Sphere x(u,v) = r cos q sin f y(u,v) = r sin q sin f z(u,v) = r cos f 360  q  0 180  f  0 q constant: circles of constant longitude f constant: circles of constant latitude differentiate to show n = p
  • 16. Angel: Interactive Computer Graphics 3E © Addison-Wesley 16 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) q(u) p(0) q(1) join point p(1) = q(0)
  • 17. Angel: Interactive Computer Graphics 3E © Addison-Wesley 17 Parametric Polynomial Curves u c u x i N i xi    0 ) ( u c u y j M j yj    0 ) ( u c u z k L k zk    0 ) ( •If N=M=K, we need to determine 3(N+1) coefficients •Equivalently we need 3(N+1) independent conditions •Noting that the curves for x, y and z are independent, we can define each independently in an identical manner •We will use the form where p can be any of x, y, z u c u k L k k    0 ) ( p
  • 18. Angel: Interactive Computer Graphics 3E © Addison-Wesley 18 Why Polynomials • Easy to evaluate • Continuous and differentiable everywhere – Must worry about continuity at join points including continuity of derivatives p(u) q(u) join point p(1) = q(0) but p’(1)  q’(0)
  • 19. Angel: Interactive Computer Graphics 3E © Addison-Wesley 19 Cubic Parametric Polynomials • N=M=L=3, gives balance between ease of evaluation and flexibility in design • Four coefficients to determine for each of x, y and z • Seek four independent conditions for various values of u resulting in 4 equations in 4 unknowns for each of x, y and z – Conditions are a mixture of continuity requirements at the join points and conditions for fitting the data u c u k k k    3 0 ) ( p
  • 20. Angel: Interactive Computer Graphics 3E © Addison-Wesley 20 Cubic Polynomial Surfaces v u c v u j i i j ij     3 0 3 0 ) , ( p p(u,v)=[x(u,v), y(u,v), z(u,v)]T where p is any of x, y or z Need 48 coefficients ( 3 independent sets of 16) to determine a surface patch
  • 21. Designing Parametric Cubic Curves Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico
  • 22. Angel: Interactive Computer Graphics 3E © Addison-Wesley 22 Objectives • Introduce the types of curves – Interpolating – Hermite – Bezier – B-spline • Analyze their performance
  • 23. Angel: Interactive Computer Graphics 3E © Addison-Wesley 23 Matrix-Vector Form u c u k k k    3 0 ) ( p              c c c c 3 2 1 0 c              u u u 3 2 1 u define u c c u T T u   ) ( p then
  • 24. Angel: Interactive Computer Graphics 3E © Addison-Wesley 24 Interpolating Curve p0 p1 p2 p3 Given four data (control) points p0 , p1 ,p2 , p3 determine cubic p(u) which passes through them Must find c0 ,c1 ,c2 , c3
  • 25. Angel: Interactive Computer Graphics 3E © Addison-Wesley 25 Interpolation Equations apply the interpolating conditions at u=0, 1/3, 2/3, 1 p0=p(0)=c0 p1=p(1/3)=c0+(1/3)c1+(1/3)2c2+(1/3)3c2 p2=p(2/3)=c0+(2/3)c1+(2/3)2c2+(2/3)3c2 p3=p(1)=c0+c1+c2+c2 or in matrix form with p = [p0 p1 p2 p3]T p=Ac                                                        1 1 1 1 3 2 3 2 3 2 1 3 1 3 1 3 1 1 0 0 0 1 3 2 3 2 A
  • 26. Angel: Interactive Computer Graphics 3E © Addison-Wesley 26 Interpolation Matrix Solving for c we find the interpolation matrix                      5 . 4 5 . 13 5 . 13 5 . 4 5 . 4 18 5 . 22 9 1 5 . 4 9 5 . 5 0 0 0 1 1 A MI c=MIp Note that MI does not depend on input data and can be used for each segment in x, y, and z
  • 27. Angel: Interactive Computer Graphics 3E © Addison-Wesley 27 Interpolating Multiple Segments use p = [p0 p1 p2 p3]T use p = [p3 p4 p5 p6]T Get continuity at join points but not continuity of derivatives
  • 28. Angel: Interactive Computer Graphics 3E © Addison-Wesley 28 Blending Functions Rewriting the equation for p(u) p(u)=uTc=uTMIp = b(u)Tp where b(u) = [b0(u) b1(u) b2(u) b3(u)]T is an array of blending polynomials such that p(u) = b0(u)p0+ b1(u)p1+ b2(u)p2+ b3(u)p3 b0(u) = -4.5(u-1/3)(u-2/3)(u-1) b1(u) = 13.5u (u-2/3)(u-1) b2(u) = -13.5u (u-1/3)(u-1) b3(u) = 4.5u (u-1/3)(u-2/3)
  • 29. Angel: Interactive Computer Graphics 3E © Addison-Wesley 29 Blending Functions • These functions are not smooth – Hence the interpolation polynomial is not smooth
  • 30. Angel: Interactive Computer Graphics 3E © Addison-Wesley 30 Interpolating Patch v u c v u p j j ij i o i      3 0 3 ) , ( Need 16 conditions to determine the 16 coefficients cij Choose at u,v = 0, 1/3, 2/3, 1
  • 31. Angel: Interactive Computer Graphics 3E © Addison-Wesley 31 Matrix Form Define v = [1 v v2 v3]T C = [cij] P = [pij] p(u,v) = uTCv If we observe that for constant u (v), we obtain interpolating curve in v (u), we can show p(u,v) = uTMIPMI Tv C=MIPMI
  • 32. Angel: Interactive Computer Graphics 3E © Addison-Wesley 32 Blending Patches p v b u b v u p ij j j i o i ) ( ) ( ) , ( 3 0 3      Each bi(u)bj(v) is a blending patch Shows that we can build and analyze surfaces from our knowledge of curves
  • 33. Angel: Interactive Computer Graphics 3E © Addison-Wesley 33 Other Types of Curves and Surfaces • How can we get around the limitations of the interpolating form – Lack of smoothness – Discontinuous derivatives at join points • We have four conditions (for cubics) that we can apply to each segment – Use them other than for interpolation – Need only come close to the data
  • 34. Angel: Interactive Computer Graphics 3E © Addison-Wesley 34 Hermite Form p(0) p(1) p’(0) p’(1) Use two interpolating conditions and two derivative conditions per segment Ensures continuity and first derivative continuity between segments
  • 35. Angel: Interactive Computer Graphics 3E © Addison-Wesley 35 Equations Interpolating conditions are the same at ends p(0) = p0 = c0 p(1) = p3 = c0+c1+c2+c3 Differentiating we find p’(u) = c1+2uc2+3u2c3 Evaluating at end points p’(0) = p’0 = c1 p’(1) = p’3 = c1+2c2+3c3
  • 36. Angel: Interactive Computer Graphics 3E © Addison-Wesley 36 Matrix Form c q                           3 2 1 0 0 0 1 0 1 1 1 1 0 0 0 1 p' p' p p 3 0 3 0 Solving, we find c=MHq where MH is the Hermite matrix                  1 1 2 2 1 2 3 3 0 1 0 0 0 0 0 1 MH
  • 37. Angel: Interactive Computer Graphics 3E © Addison-Wesley 37 Blending Polynomials p(u) = b(u)Tq                     u u u u u u u u u u 2 3 2 3 2 3 2 3 2 3 2 1 3 2 ) ( b 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 However, the Hermite form is the basis of the Bezier form
  • 38. Angel: Interactive Computer Graphics 3E © Addison-Wesley 38 Parametric and Geometric Continuity • We can require the derivatives of x, y,and z to each be continuous at join points (parametric continuity) • Alternately, we can only require that the tangents of the resulting curve be continuous (geometry continuity) • The latter gives more flexibility as we have need satisfy only two conditions rather than three at each join point
  • 39. Angel: Interactive Computer Graphics 3E © Addison-Wesley 39 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
  • 40. Angel: Interactive Computer Graphics 3E © Addison-Wesley 40 Higher Dimensional Approximations • The techniques for both interpolating and Hermite curves can be used with higher dimensional parametric polynomials • For interpolating form, the resulting matrix becomes increasingly more ill-conditioned and the resulting curves less smooth and more prone to numerical errors • In both cases, there is more work in rendering the resulting polynomial curves and surfaces
  • 41. Bezier and Spline Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico
  • 42. Angel: Interactive Computer Graphics 3E © Addison-Wesley 42 Objectives • Introduce the Bezier curves and surfaces • Derive the required matrices • Introduce the B-spline and compare it to the standard cubic Bezier
  • 43. Angel: Interactive Computer Graphics 3E © Addison-Wesley 43 Bezier’s Idea • 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
  • 44. Angel: Interactive Computer Graphics 3E © Addison-Wesley 44 Approximating Derivatives p0 p1 p2 p3 p1 located at u=1/3 p2 located at u=2/3 3 / 1 p p ) 0 ( ' p 0 1   3 / 1 p p ) 1 ( ' p 2 3   slope p’(0) slope p’(1) u
  • 45. Angel: Interactive Computer Graphics 3E © Addison-Wesley 45 Equations p(0) = p0 = c0 p(1) = p3 = c0+c1+c2+c3 p’(0) = 3(p1- p0) = c0 p’(1) = 3(p3- p2) = c1+2c2+3c3 Interpolating conditions are the same Approximating derivative conditions Solve four linear equations for c=MBp
  • 46. Angel: Interactive Computer Graphics 3E © Addison-Wesley 46 Bezier Matrix                  1 3 3 1 0 3 6 3 0 0 3 3 0 0 0 1 MB p(u) = uTMBp = b(u)Tp blending functions
  • 47. Angel: Interactive Computer Graphics 3E © Addison-Wesley 47 Blending Functions                   u u u u u u u 3 2 2 3 ) 1 ( 2 ) 1 ( 3 ) 1 ( ) ( b Note that all zeros are at 0 and 1 which forces the functions to be smooth over (0,1)
  • 48. Angel: Interactive Computer Graphics 3E © Addison-Wesley 48 Bernstein Polynomials • The blending functions are a special case of the Bernstein polynomials • These polynomials give the blending polynomials for any degree Bezier form – All zeros at 0 and 1 – For any degree they all sum to 1 – They are all between 0 and 1 inside (0,1) ) 1 ( )! ( ! ! ) ( kd u u k d k d u b k d k    
  • 49. Angel: Interactive Computer Graphics 3E © Addison-Wesley 49 Convex Hull Property • The properties of the Bernstein polynomials ensure that all Bezier curves lie in the convex hull of their control points • Hence, even though we do not interpolate all the data, we cannot be too far away p0 p1 p2 p3 convex hull Bezier curve
  • 50. Angel: Interactive Computer Graphics 3E © Addison-Wesley 50 Bezier Patches Using same data array P=[pij] as with interpolating form v u p v b u b v u p T B B T ij j i j i M P M      ) ( ) ( ) , ( 3 0 3 0 Patch lies in convex hull
  • 51. Angel: Interactive Computer Graphics 3E © Addison-Wesley 51 Analysis • Although the Bezier form is much better than the interpolating form, we have the derivatives are not continuous at join points • Can we do better? – Go to higher order Bezier • More work • Derivative continuity still only approximate • Supported by OpenGL –Apply different conditions • Tricky without letting order increase
  • 52. Angel: Interactive Computer Graphics 3E © Addison-Wesley 52 B-Splines • Basis splines: use the data at p=[pi-2 pi-1 pi pi-1]T to define curve only between pi-1 and pi • Allows us to apply more continuity conditions to each segment • For cubics, we can have continuity of function, first and second derivatives at join points • Cost is 3 times as much work for curves – Add one new point each time rather than three • For surfaces, we do 9 times as much work
  • 53. Angel: Interactive Computer Graphics 3E © Addison-Wesley 53 Cubic B-spline                  1 3 3 1 0 3 6 3 0 3 0 3 0 1 4 1 MS p(u) = uTMSp = b(u)Tp
  • 54. Angel: Interactive Computer Graphics 3E © Addison-Wesley 54 Blending Functions                      u u u u u u u u 3 2 2 3 2 3 3 3 3 1 3 6 4 ) 1 ( 6 1 ) ( b convex hull property
  • 55. Angel: Interactive Computer Graphics 3E © Addison-Wesley 55 B-Spline Patches v u p v b u b v u p T S S T ij j i j i M P M      ) ( ) ( ) , ( 3 0 3 0 defined over only 1/9 of region
  • 56. Angel: Interactive Computer Graphics 3E © Addison-Wesley 56 Splines and Basis • If we examine the cubic B-spline from the perspective of each control (data) point, each interior point contributes (through the blending functions) to four segments • We can rewrite p(u) in terms of the data points as defining the basis functions {Bi(u)} p u B u p i i ) ( ) (  
  • 57. Angel: Interactive Computer Graphics 3E © Addison-Wesley 57 Basis Functions 2 2 1 1 1 1 2 2 0 ) 1 ( ) ( ) 1 ( ) 2 ( 0 ) ( 3 2 1 0                                i u i u i i u i i u i i u i i u u b u b u b u b u Bi In terms of the blending polynomials
  • 58. Angel: Interactive Computer Graphics 3E © Addison-Wesley 58 Generalizing Splines • We can extend to splines of any degree • Data and conditions to not have to given at equally spaced values (the knots) – Nonuniform and uniform splines – Can have repeated knots • Can force spline to interpolate points • Cox-deBoor recursion gives method of evaluation
  • 59. Angel: Interactive Computer Graphics 3E © Addison-Wesley 59 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 • Requires a perspective division – NURBS act correctly for perspective viewing • Quadrics are a special case of NURBS
  • 60. Rendering Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico
  • 61. Angel: Interactive Computer Graphics 3E © Addison-Wesley 61 Objectives • Introduce methods to draw curves – Approximate with lines – Finite Differences • Derive the recursive method for evaluation of Bezier curves and surfaces • Learn how to convert all polynomial data to data for Bezier polynomials
  • 62. Angel: Interactive Computer Graphics 3E © Addison-Wesley 62 Evaluating Polynomials • Simplest method to render a polynomial curve is to evaluate the polynomial at many points and form an approximating polyline • For surfaces we can form an approximating mesh of triangles or quadrilaterals • Use Horner’s method to evaluate polynomials p(u)=c0+u(c1+u(c2+uc3)) – 3 multiplications/evaluation for cubic
  • 63. Angel: Interactive Computer Graphics 3E © Addison-Wesley 63 Finite Differences ) ( ) ( ) 0 ( uk p uk p   ) ( ) 1 ( ) ( ) 1 ( uk p uk p uk p     ) ( ) 1 ( ) ( ) ( ) ( ) 1 ( uk p uk p uk p m m m        For equally spaced {uk} we define finite differences For a polynomial of degree n, the nth finite difference is constant
  • 64. Angel: Interactive Computer Graphics 3E © Addison-Wesley 64 Building a Finite Difference Table p(u)=1+3u+2u2+u3
  • 65. Angel: Interactive Computer Graphics 3E © Addison-Wesley 65 Finding the Next Values Starting at the bottom, we can work up generating new values for the polynomial
  • 66. Angel: Interactive Computer Graphics 3E © Addison-Wesley 66 deCasteljau Recursion • We can use the convex hull property of Bezier curves to obtain an efficient recursive method that does not require any function evaluations – Uses only the values at the control points • Based on the idea that “any polynomial and any part of a polynomial is a Bezier polynomial for properly chosen control data”
  • 67. Angel: Interactive Computer Graphics 3E © Addison-Wesley 67 Splitting a Cubic Bezier p0, p1 , p2 , p3 determine a cubic Bezier polynomial and its convex hull Consider left half l(u) and right half r(u)
  • 68. Angel: Interactive Computer Graphics 3E © Addison-Wesley 68 l(u) and r(u) Since l(u) and r(u) are Bezier curves, we should be able to find two sets of control points {l0, l1, l2, l3} and {r0, r1, r2, r3} that determine them
  • 69. Angel: Interactive Computer Graphics 3E © Addison-Wesley 69 Convex Hulls {l0, l1, l2, l3} and {r0, r1, r2, r3}each have a convex hull that that is closer to p(u) than the convex hull of {p0, p1, p2, p3} This is known as the variation diminishing property. The polyline from l0 to l3 (= r0) to r3 is an approximation to p(u). Repeating recursively we get better approximations.
  • 70. Angel: Interactive Computer Graphics 3E © Addison-Wesley 70 Equations Start with Bezier equations p(u)=uTMBp l(u) must interpolate p(0) and p(1/2) l(0) = l0 = p0 l(1) = l3 = p(1/2) = 1/8( p0 +3 p1 +3 p2 + p3 ) Matching slopes, taking into account that l(u) and r(u) only go over half the distance as p(u) l’(0) = 3(l1 - l0) = p’(0) = 3/2(p1 - p0 ) l’(1) = 3(l3 – l2) = p’(1/2) = 3/8(- p0 - p1+ p2 + p3) Symmetric equations hold for r(u)
  • 71. Angel: Interactive Computer Graphics 3E © Addison-Wesley 71 Efficient Form l0 = p0 r3 = p3 l1 = ½(p0 + p1) r1 = ½(p2 + p3) l2 = ½(l1 + ½( p1 + p2)) r1 = ½(r2 + ½( p1 + p2)) l3 = r0 = ½(l2 + r1) Requires only shifts and adds!
  • 72. Angel: Interactive Computer Graphics 3E © Addison-Wesley 72 Every Curve is a Bezier Curve • We can render a given polynomial using the recursive method if we find control points for its representation as a Bezier curve • Suppose that p(u) is given as an interpolating curve with control points q • There exist Bezier control points p such that • Equating and solving, we find p=MB -1MI p(u)=uTMIq p(u)=uTMBp
  • 73. Angel: Interactive Computer Graphics 3E © Addison-Wesley 73 Matrices Interpolating to Bezier B-Spline to Bezier                       1 0 0 0 6 5 3 2 3 3 1 3 1 2 3 3 6 5 0 0 0 1 1 M M I B               1 4 1 0 0 4 2 0 0 2 4 0 0 1 4 1 1 M M S B
  • 74. Angel: Interactive Computer Graphics 3E © Addison-Wesley 74 Example These three curves were all generated from the same original data using Bezier recursion by converting all control point data to Bezier control points Bezier Interpolating B Spline
  • 75. Angel: Interactive Computer Graphics 3E © Addison-Wesley 75 Surfaces • Can apply the recursive method to surfaces if we recall that for a Bezier patch curves of constant u (or v) are Bezier curves in u (or v) • First subdivide in u – Process creates new points – Some of the original points are discarded original and kept new original and discarded
  • 76. Angel: Interactive Computer Graphics 3E © Addison-Wesley 76 Second Subdivision 16 final points for 1 of 4 patches created
  • 77. Angel: Interactive Computer Graphics 3E © Addison-Wesley 77 Normals • For rendering we need the normals if we want to shade – Can compute from parametric equations – Can use vertices of corner points to determine – OpenGL can compute automatically v v u u v u       ) , ( ) , ( p p n
  • 78. Angel: Interactive Computer Graphics 3E © Addison-Wesley 78 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
  • 79. Angel: Interactive Computer Graphics 3E © Addison-Wesley 79 Quadrics • Any quadric can be written as the quadratic form pTAp+bTp+c=0 where p=[x, y, z]T with A, b and c giving the coefficients • Render by ray casting – Intersect with parametric ray p(a)=p0+ad that passes through a pixel – Yields a scalar quadratic equation • No solution: ray misses quadric • One solution: ray tangent to quadric • Two solutions: entry and exit points