Title: Modeling Curves and Surfaces
1Modeling Curves and Surfaces
2Curves and Surfaces
- Observation Many objects we want to model and
display are not straight or flat. - Ex. Text, sketches, chairs, animals, plants,
buildings. - How can we represent a curve?
- A large number of points on the curve.
- Approximate with connected line segments.
- piecewise linear approximation
- How can we represent a surface?
- A large number of points on the surface.
- Approximate with a polygon mesh.
- Set of polygons where each edge is part of only 1
or 2 polygons.
3Accuracy/Space Trade-off
- Problem
- Piecewise linear approximations require many
pieces to look good (realistic, smooth, etc.). - Set of individual curve or surface points would
take large amounts of storage. - Solution
- Higher-order formulae for coordinates on
curve/surface. - If a simple formula wont work, subdivide
curve/surface into pieces that can be represented
by simple formulae. - May still be an approx., but uses much less
storage. - Downside harder to specify and render.
4Higher-order Formulae
- Explicit Functions y f(x) e.g. y2x2
- Only one value of y for each x
- Difficult to represent a slope of infinity
- Implicit Equations f(x,y)0 e.g. x2y2-r20
- Need constraints to model just one part of a
curve - Joining curves together smoothly is difficult
- Parametric Equations xf(t), yf(t) e.g.
xt33,y3t22t1 - Slopes represented as parametric tangent vectors
(d/dt). - Easy to join curve segments smoothly.
5Parametric Curves
- Select part of curve 0 ? t ? 1
Cubic
Linear
Quadratic
x axt3 bxt2 cxt dx
xaxt bx
x axt2 bxt cx
y ayt3 byt2 cyt dy
yayt by
y ayt2 byt cy
z azt3 bzt2 czt dz
zazt bz
z azt2 bzt cz
- Cubic preferred - A balance between flexibility
and complexity in specifying and computing shape. - Need 4 known to determine 4 unknown coefficients.
6Parametric Equations
x axt3 bxt2 cxt dx
y ayt3 byt2 cyt dy
z azt3 bzt2 czt dz
7The Basis Matrix and Geometric Matrix
- Q(t) G M T
- Geometry Matrix Basis Matrix T Matrix
- Idea Different curves can be specified by
changing the geometric information in the
geometry matrix. - The curve is the weighted sum of the elements of
the geometry matrix, G. - The basis matrix contains constant values
specific to a family of curves.
8Joining Curve Segments Together
- G0 geometric continuity Two curve segments join
together - G1 geometric continuity The direction of the two
segments tangent vectors are equal at the join
point - C1 (parametric) continuity Tangent vectors of
the two segments are equal in magnitude and
direction - (C1 ? G1 unless tangent vector 0, 0, 0)
- Cn (parametric) continuity Direction and
magnitude through the nth derivative are equal at
the join point
9Joining Examples
Join point
C2
C1
C0
S joins C0, C1, and C2 with C0, C1, and C2
continuity, respectively.
Q1 and Q2 are C1 continuous because their
tangents, TV1 and TV2, are equal. Q1 and Q3 are
only G1 continuous.
10Curve Families
11Blending Function
- Blending functions of a curve family are defined
by MT - Set of functions in t
- There is one blending function for each of the
pieces of geometric information in the G matrix. - The value of a blending function at a certain
value of t determines the effect of the
corresponding piece of geometric information at
that point along the curve.
12Hermite Curves
- Defined by two endpoints and tangents at the
endpoints.
R1
P4
R4
P1
13Hermite Curve Examples
R1
P4
P1
R4
The set of Hermite curves that have the same
values for the endpoints P1 and P4, tangent
vectors R1 and R4 of the same direction, but with
different magnitudes for R1. The magnitude of R4
remains fixed.
14Hermite Curve Examples (cont.)
All tangent vector magnitudes are equal, but the
direction of the left tangent vector varies.
15Hermite Basis Matrix
16Hermite Basis Matrix
17Hermite Blending Functions
18Bézier Curves
Curves for four control points, P1, P2, P3, and P4
Convex Hull
19Bézier Matrices
- P1 P4 endpoints
- R1 3(P2-P1), R4 3(P4-P3)
- constant velocity curves if control points are
equally spaced
20Bézier Blending Functions
The Bernstein polynomials
21Bézier Curve Characteristics
- The functions interpolate the first and last
vertex points. - The tangent at P1 is given by P2-P1, and the
tangent at Pn1 by Pn1-Pn. - The blending functions are symmetric with respect
to t and (1-t). This means we can reverse the
sequence of vertex points defining the curve
without changing the shape of the curve. - The curve, Q(t), lies within the convex hull
defined by the control points. - If the first and last vertices coincide, then we
produce a closed curve. - If complicated curves are to be generated, they
can be formed by piecing together several Bézier
sections. - By specifying multiple coincident points at a
vertex, we pull the curve in closer and closer to
that vertex.
22Splines
- Its easy to ensure joins between Hermite or
Bézier are G1 or C1 (tangents defined directly),
but ensuring C2 is not. - A spline is a curve that is C2 continuous
through-out. - A natural spline is defined by n control points.
- The curve may or may not pass through any one
control point. - Moving one control point changes the entire
curve. - Calculating the coefficients for the n1 degree
polynomial is computationally expensive.
23B-Splines
- A B-Spline defines a curve with m1 control
points, P0, P1, ... Pm, m?3, which define
m-2 connected, cubic polynomial, curve segments,
Q3 to Qm. - The curve segments join at knots, and the
endpoints of the entire curve are also called
knots m-1 knots. - A curve segment Qi is defined by the control
points Pi-3, Pi-2, Pi-1, and Pi.
- Key feature moving a control point has a local
effect. - Effects four curve segments.
24B-Splines (cont.)
- Uniform B-Splines have knots at equal intervals
in t. - Distances in t between adjacent knots are the
same. - Blending functions for each curve segment are the
same. - Nonuniform B-Splines parametric intervals
between knots are not equal. - Add 3 knots at each end, m3 for m1 control
points. - Can reduce continuity by having a 0 length
interval between knots. - Nonuniform Rational B-Splines (NURBS) are
commonly used in 3D modeling systems. - Curves are invariant under perspective
transformations.
25Surfaces
- Can extend parametric cubic curves to a surface.
- Parametric bicubic surface
- Use two parameters, s and t, rather than just
one. - Q(s, t)
- Q(s, tc) is a parametric cubic curve, as is Q(sc,
t) - Surface defined by 16 coefficients (16 known
values).