2 The use of
The use of curved surfacescurved surfaces allows for a higher level of allows for a higher level of modeling, especially for the construction of highly modeling, especially for the construction of highly
realistic models. realistic models.
There are several approaches to modeling There are several approaches to modeling
curved surfaces: curved surfaces: (1)
(1) Similar to Similar to polyhedral modelspolyhedral models, , we model an object by using small
we model an object by using small curved surface curved surface
patches
patches (instead of polygons) placed next to each (instead of polygons) placed next to each other.
other. (2)
(2) Another approach is Another approach is solid modelingsolid modeling, ,
that constructs a model using elementary solid that constructs a model using elementary solid objects (such as: polyhedra, spheres, cones etc.) as objects (such as: polyhedra, spheres, cones etc.) as
building blocks. building blocks.
Curved Surfaces
There are two ways to construct a model: There are two ways to construct a model:
This is the process of building the model by This is the process of building the model by
assembling many simpler objects. assembling many simpler objects.
For example, creating a (cylindrical) hole in a sphere For example, creating a (cylindrical) hole in a sphere
or a cube. or a cube.
Additive Modeling
Additive Modeling
This is the process of removing pieces from a given This is the process of removing pieces from a given
object to create a new object. object to create a new object.
Subtractive Modeling
Subtractive Modeling
Curved Surfaces
Curved Surfaces
4
Curve Representation
Curve Representation
There are three ways to represent a curve
Explicit
: y = f(x)
y = mx + b y = x2
(–) Must be a single valued function (–) Vertical lines, say x = d?
Implicit
: f(x,y) = 0
x2 + y2 - r2 = 0
(+) y can be multiple valued function of x (–) Vertical lines? (Continuity hard to detect)
Parametric
: (x, y) = (x(t), y(t))
Explicit Representation
Explicit Representation
Curve in 2D: y = f(x)
Curve in 3D: y = f(x), z = g(x)
Surface in 3D: z = f(x,y)
Problems:
How about a vertical line x = c as y = f(x)?
6
Implicit Representation
Implicit Representation
Curve in 2D: f(x,y) = 0
Line: ax + by + c = 0
Circle: x
2+ y
2– r
2= 0
Surface in 3d: f(x,y,z) = 0
Plane: ax + by + cz + d = 0
Sphere: x
2+ y
2+ z
2– r
2= 0
f(x,y,z) can describe 3D object:
Parametric Form for
Parametric Form for
Curves
Curves
Curves: single parameter t (e.g. time)
x = x(t), y = y(t), z = z(t)
Circle:
x = cos(t), y = sin(t), z = 0
Tangent described by derivative
Magnitude is “velocity”
dt t dzdt
t dydt
t dx
dt t dp
t z
t y
t x t
8
Parametric Form for
Parametric Form for
Surfaces
Surfaces
Use parameters u and v
x = x(u,v), y = y(u,v), z = z(u,v)
Describes surface as both u and v vary
Partial derivatives describe tangent plane at
each point
p(u,v) = [x(u,v) y(u,v) z(u,v)]
TAdvantages of Parametric
Advantages of Parametric
Form
Form
Parameters often have natural meaning
Easy to define and calculate
Tangent and normal
10
Lagrange Polynomial
Lagrange Polynomial
Problems:
y=f(x), no multiple values
Higher order functions tend to oscillate
No local control (change any (xi, yi) changes the whole curve) Computationally expensive due to high degree.
Given n+1 points (x0, y0), (x1, y1) …….. (xn, yn)
Piecewise Linear
Piecewise Linear
Polynomial
Polynomial
To overcome the problems with Lagrange
polynomial
Divide given points into overlap sequences of 4 points construct 3rd degree polynomial that passes through these points, p0, p1 , p2 , p3 then p3, p4 , p5 , p6 etc.
Then glue the curves so that they appear sufficiently smooth at joint points.
Questions: Questions:
1.
12 A curve is approximated by a
A curve is approximated by a piecewise polynomialpiecewise polynomial curve.
curve.
Cubic polynomials
Cubic polynomials are most often used are most often used because:
because: (1)
(1) Lower-degree polynomials offer too little flexibility Lower-degree polynomials offer too little flexibility in controlling the shape of the curve.
in controlling the shape of the curve. (2)
(2) Higher-degree polynomials can introduce unwanted Higher-degree polynomials can introduce unwanted wiggles and also require more computation.
wiggles and also require more computation.
(3)
(3) No lower-degree representation allows a curve No lower-degree representation allows a curve segment to be defined by two given endpoints with segment to be defined by two given endpoints with
given derivative at each endpoints. given derivative at each endpoints. (4)
(4) No lower-degree curves are nonplanar in 3D. No lower-degree curves are nonplanar in 3D.
Why Cubic Curves?
If the
If the directionsdirections (but not necessarily the magnitudes) (but not necessarily the magnitudes) of the two segments’ tangent vectors are equal at a
of the two segments’ tangent vectors are equal at a
join point.
join point.
G
G1 1 GeometricGeometric ContinuityContinuity
If the direction and magnitude of
If the direction and magnitude of QQnn((tt) through the ) through the
n
nth derivative are equal at the join point.th derivative are equal at the join point.
C
Cn nParametricParametric ContinuityContinuity
Measure of Smoothness
Measure of Smoothness
If two curve segments join together.
If two curve segments join together.G
G0 0 GeometricGeometric ContinuityContinuity CC0 0 ParametricParametric ContinuityContinuity
C0
If the
If the directions and magnitudesdirections and magnitudes of the two of the two
segments’ tangent vectors are equal at a join point.
segments’ tangent vectors are equal at a join point.
C
C1 1 ParametricParametric ContinuityContinuity
C1
If the direction and magnitude of
If the direction and magnitude of QQ22((tt) (curvature or ) (curvature or
acceleration
acceleration) are equal at the join point.) are equal at the join point.
C
C2 2ParametricParametric ContinuityContinuity
14
Measure of Smoothness
Measure of Smoothness
S
Joint Point
C0
C1
C2
Q1
Q2
Q3 TV3=2*TV1 TV2=TV1
• QQ11& Q& Q22 are C are C11 and G and G11
continuous continuous
• QQ11& Q& Q33 are G are G11 continuous continuous
only as Tangent vectors only as Tangent vectors
have different magnitude. have different magnitude. • Observe the effect of Observe the effect of
increasing in magnitude increasing in magnitude
of TV of TV
P0
• By increasing parametric By increasing parametric continuity we can
continuity we can
increase smoothness of
increase smoothness of
the curve.
Desirable Properties of a
Desirable Properties of a
Curve
Curve
Simple control
lines need only two points
curves will need more (but not significantly
more)
Intuitive control
Physically meaningful quantities like position,
tangent, curvature etc.
Global Vs. Local Control
Portion of curve effected by a control point.
General Parameterization
16 Given
Given n n + 1 points + 1 points PP00((xx00, , yy00), ), PP11((xx11, , yy11), …, ), …, PPnn((xxnn, , yynn))
If we require the curve to
If we require the curve to pass throughpass through all the points.
all the points.
Interpolation
Interpolation
we wish to find
we wish to find a curvea curve that, in some sense, that, in some sense, fits the fits the shape outlined by these points
shape outlined by these points..
If we require only that the curve be
If we require only that the curve be nearnear these points.
these points.
Approximation
Approximation
Based on requirements we are faced with Based on requirements we are faced with
two problems: two problems:
Interpolation Vs.
Interpolation Vs.
Approximation
Parametric Representation
Parametric Representation
of Lines
of Lines
Interpolation of two points
In Parametric form:
P1 P2
2 1 2 1 1 1 2 1 2 1 1 2 1 1 2 11
0
1
1
1
1
1
)
(
)
(
)
(
)
(
)
(
)
(
)
(
x
x
t
t
x
x
t
x
x
x
t
t
x
y
y
t
y
t
y
x
x
t
x
t
x
P
P
t
P
t
P
Parameter T Co-eff C BasisMatrix GeometryG
18
1
0
,
,
,
2 3 2 3 2 3
t
d
t
c
t
b
t
a
t
z
d
t
c
t
b
t
a
t
y
d
t
c
t
b
t
a
t
x
t
z
t
y
t
x
t
Q
z z z z y y y y x x x x
t
T
C
Q
d
d
d
c
c
c
b
b
b
a
a
a
t
t
t
t
Q
z y x z y x z y x z y x T
C2
1
3Parametric Cubic Curves
Parametric Cubic Curves
Parametric Cubic Curves
Now co-efficient matrix C can be expressed as a multiple of basis(weight) matrix M and geometry matrix G.
t
x
t
y
t
z
t
T
C
T
M
G
Q
vectorgeometry ix
basis matr
G
G
G
G
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
t
t
t
t
Q
4 3 2 1
44 43
42 41
34 33
32 31
24 23
22 21
14 13
12 11
2
3
1
)
(
Each element of geometry vector G has 3 component for x, y and z.
20
x x x x xg
g
g
g
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
m
t
t
t
G
M
T
t
x
4 3 2 1 44 43 42 41 34 33 32 31 24 23 22 21 14 13 12 11 2 31
)
(
xfunction blending a x x x
g
m
tm
m
t
m
t
g
m
tm
m
t
m
t
g
m
tm
m
t
m
t
g
m
tm
m
t
m
t
t
x
4 44 34 24 2 14 3 3 43 33 23 2 13 3 2 42 32 22 2 12 3 1 41 31 21 2 11 3
Parametric Cubic Curves
Parametric Cubic Curves
Multiplying out only the x-component we get
The curve is a weighted sum of the elements of geometry matrix
Derivative of
Derivative of
Q(t)
Q(t)
Derivative of Q(t) is the parametric tangent vector of the curve.
t
axt bxt cx ayt byt cy azt bzt cz
QC t
t C
T dt
d t
Q
t z dt
d t
y dt
d t
x dt
d t
Q dt
t dQ
2 3
2 3
2 3
0 1
2 3
) (
2 2
2
2
22 A curve segment
A curve segment QQ((tt) is defined by ) is defined by constraintsconstraints on: on:
Each cubic polynomial of
Each cubic polynomial of QQ((tt) has ) has 4 coefficients4 coefficients,, (1)
(1) endpoints endpoints (2)
(2) tangent vectors tangent vectors and
and (3) (3) continuity between segments continuity between segments
so
so 4 constraints4 constraints will be needed, will be needed, allowing us
allowing us to formulate
to formulate 4 equations in the 4 unknowns4 equations in the 4 unknowns,, then solving for the unknowns.
then solving for the unknowns.
Curve Design :
Curve Design :
Determining
A cubic
A cubic Hermite curveHermite curve segment interpolating the segment interpolating the endpoints
endpoints PP11 and and PP4 4 is determined by constraints onis determined by constraints on
the endpoints
the endpoints PP11 and and PP44 and
and
tangent vectors at the endpoints
tangent vectors at the endpoints RR11 and and RR44
P
P11
P
P44
R
R11 RR44
Hermit Curves
24 The Hermite Geometry Vector:
The Hermite Geometry Vector:
4 1 4 1 R R P P GH
x x H H H H x x x x x G M t t t G M T C T d t c t b t a t x 1 2 3 2 3The constraints on
The constraints on xx(0) and (0) and xx(1):(1):
t t t M H GHx x 3 2 2 1 0
Hence the tangent-vector constraints:
Hence the tangent-vector constraints:
R xx
MHH GHHxx x G M R x 0 1 2 3 1 0 1 0 0 0 4 1The 4 constraints can be written as:
The 4 constraints can be written as:
x
x H H
26 0 0 0 1 0 1 0 0 1 2 3 3 1 1 2 2 0 1 2 3 0 1 0 0 1 1 1 1 1 0 0 0 1 H M
42 3 1 2 3 4 2 3 1 2 3 2 3 2 1 3 2 R t t R t t t P t t P t t G B G M T t z t y t x t
Q H H H H
1
1
1
1 tt
f
f((tt))
P
P11 PP44
R
R11
R
R44
The Hermite Blending Functions
The Hermite Blending Functions
Hermit Curves
28
Hermit Curves
Hermit Curves
7 4 7 4
4 1 4 1
R kR
P P
R R P P
7 6 5 4 3 2
1, P , P , P , P , P , P P
1 1
Indirectly specifies the endpoint tangent vectors by
Indirectly specifies the endpoint tangent vectors by
specifying two intermediate points that are not on
specifying two intermediate points that are not on
the curve.
the curve.
1 2
2 1
1 Q 0 PP 3 P P
R
P
P11
P
P44
P
P22
P
P33
B
30 The B
The Bézier ézier Geometry Vector:Geometry Vector:
4 3 2 1 P P P P GB B HB
H M G
P P P P R R P P
G
4 3 2 1 4 1 4 1 3 3 0 0 0 0 3 3 1 0 0 0 0 0 0 1
MHH MHHB
GB H T MHBB GBB T G M M T G M T t Q B
0 0
0 1
0 0
3 3
0 3
6 3
1 3
3 1
H HB
B M M
M
3 4 32 2
2 1
3 3 1 3 1
1 t P t t P t t P t P
G M
T t
Q B B
The 4 polynomials in
The 4 polynomials in BBB B = = T . MT . MB B are called the are called the Bernstein polynomials
Bernstein polynomials..
B
32 The Bernstein Polynomials
The Bernstein Polynomials
1
1
1
1
t
t
f
f((tt))
1
B
B
2
B
B
3
B
B
4
B
B
B
B
ézier Curves
ézier Curves
What's a Spline?
What's a Spline?
Smooth curve defined by some control
points
34
Splines
Other Curves
Other Curves
Natural Cubic Spline
C0, C1 and C2 continuous cubic polynomial
Smoother than previous curves which don’t have C2
continuity.
Interpolates all of the control points
B-Splines
C0, C1 and C2 continuous cubic polynomial
Don’t interpolate the control points Varieties:
Uniform Vs Nonuniform Rational Vs Non-rational
36
Q(0)
Q(1)
Catmull-Rom Splines
Catmull-Rom Splines
Interpolation splines i.e. Passes through all control points. Tangent at any control point is parallel to the line joining the control points adjacent to that point.
Curve Rendering
Curve Rendering
Brute-Force method
Forward differencing
Recursive sub-division
Brute-Force method
t = 0;
for (i=0; i <= 100; i++) { x(t) = axt3+ b
xt2+ cxt+ dx
y(t) = ayt3+ b
yt2+ cyt+ dy
x(t) = azt3+ b
zt2+ czt+ dz
Plot3d( x(t), y(t), z(t) ); t += 0.01;
}
38
Curve Rendering
Curve Rendering
Curve Rendering
Curve Rendering
Forward differencing method
= 1 / n;
f =d; f = a3+ b3+ c; f 2= 6a3+ 2b2; f 3= 6a3; Plot(f.x, f.y, f.z );
for (i=0; i <= n; i++) {
f += f ; f += f 2; f 2+= f 3; [for each var] Plot(f.x, f.y, f.z );
40
Curve Rendering
Curve Rendering
Recursive sub-division
Void DrawCurveRecSub(curve, )
{
if (Straight(curve, )
DrawLine(curve); else {
SubdivideCurve(curve, leftCurve, rightCurve);
DrawCurveRecSub(leftCurve, );
DrawCurveRecSub(RightCurve, );
} }
P1
P4 P2
P3 d2
d3
Sub-Division of B
Sub-Division of B
ézier
ézier
Curves
Curves
3 1 Bs L PP PP G D i 1 3 31 4 2 0
24 4 0 0
0 0 0 8 81 Bs GL 2 4 3 1 Bs R P PP G D i 1 3 3 1 4 4 0
00 2 4 2
81
Bs
G
Curved Surfaces
Planer Surfaces
Planer Surfaces
Parametric Bicubic
Parametric Bicubic
Surfaces
Surfaces
Generalization of parametric cubic curves
The elements of geometry matrix are curves
themselves instead of constants.
)
(
)
(
)
(
)
(
1
)
(
)
,
(
4 3 2 1 2 3t
G
t
G
t
G
t
G
M
s
s
s
t
G
M
S
t
s
Q
s s46
Parametric Bicubic
Parametric Bicubic
Surfaces
Surfaces
T T T T48
Hermite Surfaces
Hermite Surfaces
Hermite Surfaces are completely defined by a 4X4 geometry Matrix GH
The surface is a
stacking of (s) Curves Each (s) curve is a Hermite Curve
With end points and end tangents as
Hermite Surface
50
Hermite Surface
Hermite Surface
P(0,0) P(0,1) P(1,1) P(1,0) t ) 0 , 0 ( P t ) 1 , 0 ( P t P(1,1)
Connecting Hermite
Connecting Hermite
Patches
Patches
To join two patches in
s
direction:
Patch 1 Patch 2
t = 1
t = 0
s = 1 s = 0
s = 0 s = 1 t = 1
t = 0 t s 44 43 42 41 24 23 22 21 44 43 42 41 24 23 22 21 2 1 kg kg kg kg g g g g g g g g g g g g Patch Patch
52
B
B
ézier Surface
ézier Surface
Bézier geometry matrix
G
consists of 16 control
points.
Bézier bicubic formulation can be derived in
exactly the same way as the Hermite cubic:
Ref: FV Chapter 11
11.2, 11.2.1, 11.2.3(as far as covered in class) 11.2.6, 11.2.7, 11.2.9
11.3-11.3.2