Lectures - 11 - 12 - Curve - and Surface - Representation
Lectures - 11 - 12 - Curve - and Surface - Representation
2
INTRODUCTION
• Most common representation for surfaces:
– polygon mesh
Polygons are used in computer graphics to compose
images that are three-dimensional in appearance
– parametric surfaces
– quadric surfaces
• Solid modeling
3
TYPES OF CURVES / SURFACES
• Explicit:
y = mx + b z = A x + By + C
For each point value X we have a value of y; Simply compute and Plot
Ax + By + C = 0 (x – x0)2 + (y – y0)2 – r2 = 0
curve by a parameter
x = x0 + (x1 – x0)tLecture 5
10/10/2008 x = x0 + rcos 4
IMPLICIT SURFACES
• Functions in the form of F(x,y,z) = 0
– i.e. Quadric functions
2 2 2
Sphere: f(x,y,z) = x + y + z = 0 molecular modeling
Lecture 5 5
METABALLS
• Each metaball is defined as a function in n-dimensions (e.g., for three
dimensions, f ( x , y , z ) Three-dimensional metaballs tend to be most
common, with two-dimensional implementations popular as well).
6
METABALLS
• One type of implicit surface
• Also known as blobby objects
• Negative volume to produce hollows
• Can be used to model smooth surfaces, liquid
Lecture 5 7
QUADRIC SURFACES
8
PARAMETRIC CUBIC CURVES
• Parametric representation:
– x = x(t), y = y(t), z = z(t)
• overcomes problems with explicit and implicit forms and
Parametric curves are very flexible.
• Parameter count gives the object’s dimension.
(x(t,v), y(t,v), z(t,v))2 : D surface
• Coord functions independent.
– a curve is approximated by a piecewise polynomial curve
9
PARAMETRIC CUBIC
CURVES
• Why cubic?
– lower-degree polynomials give too little flexibility in controlling the
shape of the curve
– higher-degree polynomials can introduce unwanted wiggles and require
more computation
– lowest degree that allows specification of endpoints and their derivatives
– lowest degree that is not planar in 3D
10
PARAMETRIC CUBIC CURVES
• General form:
3 2
x (t ) a x t bx t c x t d x
3 2
y (t ) a y t by t c y t d y
3 2
z (t ) a z t bz t c z t d z
3 2
T [t t t 1] 0< t <1
Transmission
parameter
11
PARAMETRIC CUBIC CURVES
3 2
T [t t t 1]
ax ay az
b by bz
C x
cx cy cz
d x dy d z
12
PARAMETRIC CUBIC CURVES
Q(t ) [ x(t ) y (t ) z (t )]
T C T M G
13
SPECIFYING CURVES
• Control Points:
– A set of points that influence the curve’s shape.
• Interpolating curve:
– Curve passes through all of control points.
• Approximating Curves:
– Curve can miss some control points.
• Control polygon:
– Control points merely influence shape.
10/10/2008 Lecture 5 14
INTERPOLATION VS. APPROXIMATION
INTERPOLATING APPROXIMATING
PARAMETRIC CUBIC
CURVES
• Kinds of continuity:
– G0: two curve segments join together
– G1: directions of tangents are equal at the joint
– C1: directions and magnitudes of tangents are equal at
the joint
– Cn: directions and magnitudes of n-th derivative are
equal at the joint
16
PIECEWISE CURVE SEGMENTS
• We can represent an arbitrary length curve as a series of
curves pieced together.
• But we will want to control how these curves fit together …
10/10/2008 Lecture 5 18
EXAMPLE
• The curves Q1 Q2 Q3 join at point P
• Q1 and Q2 have equal tangent vectors at P and hence C1 and G1
continuous
• Q1 and Q3 have tangent vectors in the same direction but Q3
has twice magnitude, so they are only G1 continuous at P
PARAMETRIC CUBIC
CURVES
• Major types of curves:
– Hermit
• defined by two endpoints and two tangent vectors
– Bezier
• defined by two endpoints and two other points that control the
endpoint tangent vectors
– Splines
• several kinds, each defined by four points
• uniform B-splines, non-uniform B-splines, ß-splines
20
HERMITE CURVES
• A cubic polynomial
• defined by two endpoints and two tangent vectors
• Polynomial can be specified by the position of, and
gradient at, each endpoint of curve.
• The idea is to derive a curve that is smooth enough
. The cubic interpolation spline is obtained by
fitting the input points with a piecewise cubic
polynomial curve that passes every control point.
10/10/2008 Lecture 5 21
HERMITE CURVES
• A cubic polynomial
• defined by two endpoints and two tangent vectors
10/10/2008 Lecture 5 22
HERMITE CURVES
•
0< t <1
10/10/2008 Lecture 5 23
HERMITE CURVES
•
10/10/2008 Lecture 5 24
FINDING HERMITE COEFFICIENTS USING CASE1
T [t 3 t2 t 1]
25
10/10/2008 Lecture 5
FINDING HERMITE COEFFICIENTS
USING CASE1
•
10/10/2008 Lecture 5 26
FINDING HERMITE COEFFICIENTS
USING CASE1
Substituting for t at each endpoint:
x0 = X(0) = a0 x0’= X/(0) = a1
x1 = X(1) = a3 + a2 + a1 + a0 x1’= X/(1) = 3a3 + 2a2+ a1
Using the inverse matrix the solution for a3, a2, a1 , and a0 is:
a0 = x0 a1 = x0’
a2 = -3x0 – 2x0’+ 3x1 – x1’ a3 = 2x0 + x0’ - 2x1 + x1’
10/10/2008 Lecture 5 27
HERMITE BASIS (BLENDING) FUNCTIONS
CASE 1
2 1 2 1 x0
3 2 3 1 x '
X (t ) t 3 t 2 t 1
0 1 0
0
0 x1
1 0 0 0 x1 '
(2t 3 3t 2 1)x0 (t 3 2t 2 t )x0 '(2t 3 3t 2 )x1 (t 3 t 2 )x1 '
THE HERMITE MATRIX: M H
CASE 1
The resultant polynomial can be expressed in matrix form:
X(t) = tTMHq ( q is the control vector)
10/10/2008 Lecture 5 29
FINDING HERMITE COEFFICIENTS
USING CASE2
•
Lecture 5 30
FINDING HERMITE COEFFICIENTS
USING CASE2
•
Lecture 5 31
HERMITE BASIS (BLENDING) FUNCTIONS
CASE 2
2 2 1 1 x0
3 3 2 1 x
X (t ) t 3 t 2 t 1
0 0 1
1
0 x0 '
1 0 0 0 x1 '
(2t 3 3t 2 1)x0 (2t 3 3t 2 )x1 (t 3 2t 2 t )x0 ' (t 3 t 2 )x1 '
THE HERMITE MATRIX: M H
CASE 2
The resultant polynomial can be expressed in matrix form:
X(t) = tTMHq ( q is the control vector)
10/10/2008 Lecture 5 33
HERMITE BASIS (BLENDING) FUNCTIONS
x(t)
10/10/2008 Lecture 5 35
DISPLAYING HERMITE CURVES.
• Simple :
– Select step size to suit.
– Plug x values into the geometry matrix.
– Evaluate P(t) x value for current position.
– Repeat for y & z independently.
– Draw line segment between current and previous point.
• Joining curves:
– Coincident endpoints for C0 continuity
– Align tangent vectors for C1 continuity
.
10/10/2008 Lecture 5 36
BÉZIER CURVES
• Hermite cubic curves are difficult to model –
need to specify point and gradient.
• More intuitive to only specify points.
• Pierre Bézier (an engineer at Renault) specified 2
endpoints and 2 additional control points to
specify the gradient at the endpoints.
• Can be derived from Hermite matrix:
– Two end control points specify tangent
10/10/2008 Lecture 5 37
BÉZIER CURVES P2
Note the Convex Hull has been shown
as a dashed line – used as a bounding P4
extent for intersection purposes.
P1
P3
P3
P4
P1
P2
10/10/2008 Lecture 5 38
BÉZIER MATRIX
• The cubic form is the most popular
X(t) = tTMBq (MB is the Bézier matrix)
• With n=4 and r=0,1,2,3 we get:
10/10/2008 Lecture 5 39
BÉZIER BLENDING FUNCTIONS
This is how they look –
The functions sum to 1 at q0 q3
any point along the curve.
q1 q2
Endpoints have full weight
The weights of each
function is clear and the
labels show the control
points being weighted.
10/10/2008 Lecture 5 40
JOINING BEZIER CURVES
• G1 continuity is provided at the endpoint when
• P2 – P3 = k (Q1 – Q0)
• if k=1, C1 continuity is obtained
EXAMPLE
• The coordinates of four control points relative to a
curve are given by
P1(2,2,0), P2(2,3,0), P3(3,3,0) and P4(3,2,0)
• Write down the equations of Bezier curve
• Also, find the coordinate pixels of the curve for (t =0,
t=0.25, t=0.5, t=0.75, and t= 1) step = 0.25
• Also, plot the Bezier curve?
P= P0(1-t)3 + 3P1t(1-t)2 + 3P2t2(1-t) + P3t3
14/10/2008 Lecture 6 47