Comp175 14 Curves Surfaces 6up
-
Upload
tomica06031969 -
Category
Documents
-
view
14 -
download
1
Transcript of Comp175 14 Curves Surfaces 6up
11/17/10
1
COMP175: Computer Graphics
Lecture 14 Parametric Curves and Surfaces
Curves important for realism, aesthetic design, functional design
Can approximate with connected line segments
Piecewise linear functions
Can approximate with higher order functions
Piecewise line splines
Spline curve
A smooth curve specified in terms of a few control points
Interpolating curves
Some splines interpolate all of their control points
11/17/10
2
Approximating curves
Others interpolate some control points and approximate others
Mechanical splines
Historically used in design and manufacturing
A lead spline weight or “duck” Using weights and a wooden spline to draw a spline curve
Mathematical curve representation
Desired spline qualities Interpolating vs. approximating curves Continuity and ‘smoothness’
Efficient rendering and processing Locating points on the curve Subdividing curves into smaller segments Measuring accuracy of fit
Representations of shape Explicit function Implicit function Parametric representation
Curve quality
Desirable properties: Continuity Interpolation Local control
Continuity
Determined by continuity at points where the piecewise polynomial curves are joined
Each polynomial curve is smooth along its length
Want to avoid abrupt changes at segment joints
Nested degrees of continuity: C-1, C0, C1, … , CN
C-1 continuity
11/17/10
3
C0 continuity
Adjacent segments join at a common endpoint
C1 continuity
The first derivative is continuous across joints
(CN continuity: The nth derivative is continuous across joints)
Curve quality
Computer graphics often requires C1 continuity
Automotive industry often requires C2
Aircraft and race cars may require C4 or C5
Constraining curves
Constraints: interpolated points, tangent vectors, continuity
The coefficients of a polynomial curve are chosen to satisfy the specified constraints
Polynomial curve forms Hermite curves Bezier curves General spline curves: B-splines, non-uniform B-splines (NURBS), β-splines
Bezier Curves
Constraints for Bezier curves
One more control point than the order of the curve
Interpolate the control points specifying the endpoints of the curve
Approximate the other control points
11/17/10
4
Constraints for Bezier curves
€
P(t) = Bi (t)Pii= 0
N
∑
Constraints for Bezier curves
Blending functions
Force the curve to interpolate the endpoints: At t = 0, B0(t) = 1 and all other Bi(t) = 0 At t = 1, BN(t) = 1 and all other Bi(t) = 0
The other two constraints control how much the curve “wiggles” between the endpoints
€
P(t) = Bi (t)Pii= 0
N
∑
Bernstein polynomials
One choice for the blending functions
where
Example, N = 1: line segment B0 = (1-t) B1 = t
€
Bi(t) = witi(1− t)N− i
€
wi =N!
(i!(N − i)!)
Bernstein polynomials for cubic Bezier curves
The Bernstein polynomials are all positive in [0,1]
P0 has the greatest influence at t = 0
P3 has the greatest influence at t = 1
Other control points have their greatest influence where their curves are maximum
Properties of Bezier curves
The Bezier blending functions sum to 1 for all t
Thus, all points P(t) on the Bezier curve must lie inside the convex hull defined by the curve’s control points
P0
P1
P2
P3
Quadratic Bezier curve
P1
P2 P0
Control points
11/17/10
5
Quadratic Bezier curve
P1
P2 P0
Endpoint tangent direction vectors
Quadratic Bezier curve
P1
P2 P0
Convex hull
Quadratic Bezier curve
P1
P2 P0
Curve
Cubic Bezier curve
P2
P3 P0
Control points
P1
Cubic Bezier curve
Endpoint tangent directions
P2
P3 P0
P1
Cubic Bezier curve
Convex hull
P2
P3 P0
P1
11/17/10
6
Cubic Bezier curve
Curve
P2
P3 P0
P1
More cubic Bezier curves
P2
P3
P0
P1
P1
P3 P0
P2
Rendering Bezier curves
Use the parametric form of the curve Approximate the curve by a set of line segments Evaluate P(t) at N values of ti, with the ti evenly spaced between 0 and 1 to obtain
Qi = P(ti)
More about displaying curves next time…
Q0
Q1
Q2
Q3 Q4 Q5
Q6
Q7
Q8
Bezier Curves: Summary
Constrained by a set of control points, {Pi} One more control point than the order of the curve
Interpolate the endpoints of the curve and approximate the other control points of the curve
Determine points on the curve using a set of blending functions
Used Bernstein polynomials
€
P(t) = Bi (t)Pii= 0
N
∑
€
Bi(t) = witi(1− t)N− i
€
wi =N!
(i!(N − i)!)
Curved Surfaces
Piecewise patches
Represent complex curved surfaces with piecewise continuous curved patches
Constrain patches to ensure surface continuity
11/17/10
7
Linear interpolation – curves Fits the ‘simplest’ curve between two
points (i.e., a straight line)
P1
P2
P(t) = (1-t) P0 + t P1
Bi-linear interpolation – surfaces Fits the ‘simplest’ surface between four points
P10
P11
P00
P01
Linear interpolation – curves Fits the ‘simplest’ curve between two
points (i.e., a straight line)
P1
P2
P(t) = (1-t) P0 + t P1
P10
P11
P00
P01
P0(v) = (1-v)P00 + vP01
P1(v) = (1-v)P10 + vP11
v increasing
v increasing
Bi-linear interpolation – surfaces Fits the ‘simplest’ surface between four points
P11
P00
P01
Q0(u) = (1-u)P00 + uP10
Q1(u) = (1-u)P01 + uP11
u increasing
u increasing
Linear interpolation – curves Fits the ‘simplest’ curve between two
points (i.e., a straight line)
P1
P2
P(t) = (1-t) P0 + t P1
Bi-linear interpolation – surfaces Fits the ‘simplest’ surface between four points
Linear interpolation – curves Fits the ‘simplest’ curve between two
points (i.e., a straight line)
P1
P2
P(t) = (1-t) P0 + t P1
P10
P11
P00
P01
P(u,v) = (1-u)(1-v) P00 + (1-u)v P01 + u(1-v) P10 + uv P11
u increasing
v increasing
Bi-linear interpolation – surfaces Fits the ‘simplest’ surface between four points
Bi-linear surface patch
Forms a parametric expression for the curved surface
For a constant u = c, P(c,v) is a straight line For a constant v = b, P(u,b) is a straight line
… but the combined surface is curved
P10
P11
P00
P01
P(u,v) = (1-u)(1-v) P00 + (1-u)v P01 + u(1-v) P10 + uv P11
u increasing
v increasing
Bi-linear surface patch
Each line at a constant u or v is called an iso-parametric curve
For a bi-linear surface, each iso-parametric curve is a straight line P(0,v) is the line from P00 to P01
P(1,v) is the line from P10 to P11
P(u,0) is the line from P00 to P10
P(u,1) is the line from P01 to P11
P10
P11
P00
P01
P(u,v) = (1-u)(1-v) P00 + (1-u)v P01 + u(1-v) P10 + uv P11
u increasing
v increasing
11/17/10
8
Bi-linear surface patch
Alternative to evaluating P(u, v) directly:
Compute Q0(v) = P(0,v) = (1-v)P00 + vP01
and Q1(v) = P(1,v) = (1-v)P10 + vP11
Then, P(u,v) = (1-u)Q0(v) + uQ1(v)
P10
P11
P00
P01
P(u,v) = (1-u)(1-v) P00 + (1-u)v P01 + u(1-v) P10 + uv P11
u increasing
v increasing
Q0(v)���
Q1(v)���
Two cubic Bezier curves can be used as the end curves of a ruled surface patch
P0(u) ���
P1(u) ���
Two cubic Bezier curves can be used as the end curves of a ruled surface patch
P0(u) ���
P1(u) ���
Ruled surface patch
P(u,v) = (1-v)P0(u) + vP1(u)
P0(u) = P(u,0) ���
P1(u) = P(u,1) ���
P(u,v3)
P(u,v2)
P(u,v1)
Swept surfaces
Bi-linear surface A surface swept out as we move a straight
line through space Restrict endpoints of the line to lie on the
two end lines
Ruled surface A surface swept out as we move a straight
line through space Restrict endpoints of the line to lie on the
two end curves
Swept surfaces
A tensor product surface A surface swept out as we move a curve through space Change the shape of the curve as it moves through space in some controlled
manner
A tensor product Bezier surface Sweeps a Bezier curve through space by moving control points of the Bezier curve
along a Bezier curve
11/17/10
9
Tensor product Bezier patch
P0
P1
P2 P3
Tensor product Bezier patch
P0
P1
P2 P3
P0(v)���
P1(v)���
P2(v)���
P3(v)���
Tensor product Bezier patch
P0
P1
P2 P3
P0(v)���
P1(v)���
P2(v)���
P3(v)���
The original curve:
Control point curves:
€
P(u) = BiM (u)Pi
i= 0
M
∑
€
Pi(v) = B jN (v)Pij
j= 0
N
∑
P00
P10
P20 P30
P31
P32
P33
P21 P22
P23 P11 P12
P13 P01
P02
P03
Tensor product Bezier patch
€
P(u,v) =j= 0
N
∑ BiM B j
N (v)Piji= 0
M
∑
Tensor product Bezier patch
(Quadratic) curves followed by the control points
Original control points (cubic end curve)
Grid of control points
Surface
Controlling the surface
11/17/10
10
Properties of Bezier patches
Affine invariance
Convex hull
Patch boundaries Four boundary curves given by
where u = 0, u = 1, v = 0, and v = 1
€
P(u,v) =j= 0
N
∑ BiM B j
N (v)Piji= 0
M
∑
Rendering Bezier patches
Determine a set of points, P(u,v), on the surface at equally spaced increments of u and v over [0,1]
v increasing
u increasing
Rendering Bezier patches
Determine a set of points, P(u,v), on the surface at equally spaced increments of u and v over [0,1]
When points close, the surface between them is approx. planar
Approximate each patch by a quadrilateral and render these
v increasing
u increasing
Bezier patch continuity
To model more complex shapes, use a mesh of piecewise polynomial Bezier surface patches
When joining patches, need continuity constraints
Bezier patch continuity: C0
Joined patches are touching all along their shared edge
The control polygons of the two patches are the same along the shared edge
Bezier patch continuity: C1
Joined edges have collinear tangent vectors across their shared edge
A severe constraint:
Joining a cubic patch to one existing patch 8 of the new patch’s control points are constrained
Joining a cubic patch to two existing patchs even more of the new patch’s control points are constrained