Upload
kulsum-patel
View
215
Download
0
Embed Size (px)
Citation preview
7/31/2019 Curves n Surfaces_1
1/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
1
Representing Curves and Surfaces
Advanced Computer Graphics
Representing Curves and Surfaces: Part I
Dr. NARENDRA C. CHAUHAN
Associate Professor
Department of Information Technology
A.D.Patel Institute of Technology
7/31/2019 Curves n Surfaces_1
2/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
2
Representing Curves and Surfaces
Advanced Computer Graphics
Contents
Parametric Bicubic Surfaces
Hermite Curves
Polygon Meshes
Bezier Curves
Hermite, Bezier, and B-Spline Surfaces
Parametric Cubic Curves
BSplines
7/31/2019 Curves n Surfaces_1
3/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
3
Representing Curves and Surfaces
Advanced Computer Graphics
Introduction
We need smooth curves and surfaces in many
applications:
model real world objects
computer-aided design (CAD) high quality fonts
data plots
artists sketches
To specify the path of camera or object inanimation sequence
7/31/2019 Curves n Surfaces_1
4/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
4
Representing Curves and Surfaces
Advanced Computer Graphics
We need to represent curves and surfaces in 2 cases:
Modeling of existing objects (e.g. car, face, mountain) Physical objects available, but mathematicaldescription may not be available Infinitely many points can not be used
object is approximated with pieces of planes,spheres, or other shapes such the points on model areclose to points on actual object. modeling is not precise
Modeling a new object from scratch(CAD) No preexisting object available modeling is precise
7/31/2019 Curves n Surfaces_1
5/53Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
5
Representing Curves and Surfaces
Advanced Computer Graphics
Most common representation forsurface modeling:
polygon mesh surfaces
parametric surfaces They are simple generalizations of parametric curves
quadric surfaces
Solid modeling (next chapter)
Representation of volumes surrounded by surfaces
Surface modeling is also used
Introduction
7/31/2019 Curves n Surfaces_1
6/53Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
6
Representing Curves and Surfaces
Advanced Computer Graphics
Polygon mesh:
set of connected planar surfaces bounded by
polygons
good for boxes, cabinets, building exteriors bad for curved surfaces (Fig.11.1, 11.2),
representation is only approximate (piecewise
linear approximation)
errors can be made arbitrarily small at the cost ofspace and execution time
enlarged images show geometric aliasing
7/31/2019 Curves n Surfaces_1
7/53Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
7
Representing Curves and Surfaces
Advanced Computer Graphics
Parametric Polynomial Curves:
Define points on 3D curve using 3 polynomials in
parameter t, - x(t), y(t), z(t)
We use most commonly cubic polynomials.
Parametric bivariate polynomial surfacepatches:
Define points on curved surface using three
bivariate surface patches x(s,t),y(s,t),z(s,t)
Boundary of patches are parametric polynomial
curves
7/31/2019 Curves n Surfaces_1
8/53Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
8
Representing Curves and Surfaces
Advanced Computer Graphics
Quadric Surfaces:
Defined implicitly by equation f(x,y,z)=0, wh. f is a
quadric polynomial in x, y and z.
Convenient for sphere, ellipsoid, and cylinder
7/31/2019 Curves n Surfaces_1
9/53Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
9
Representing Curves and Surfaces
Advanced Computer Graphics
Polygon Meshes
7/31/2019 Curves n Surfaces_1
10/53Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
10
Representing Curves and Surfaces
Advanced Computer Graphics
Polygon mesh is a collection of edges, vertices, and polygons
connected such that each edge is shared by at most twopolygons. Edge connect two vertices and polygon is closed
sequence of edges.
Methods of representing polygon meshes:
Explicit representation
Pointers to vertex list
Pointers to edge list
Each representation has adv. and disadv. Two basic criteria, timeand space, can be used to evaluate different representations.
Operations on polygon mesh: Find all edges incident to a vertex, finding polygon sharing
edge or vertex, finding vertices connected by an edge, findingedges of a polygon, displaying mesh, etc.
7/31/2019 Curves n Surfaces_1
11/53Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
11
Representing Curves and Surfaces
Advanced Computer Graphics
Explicit Representation: Polygon is represented by list of vertex coordinates:
P=((x1,y1,z1), (x2,y2,z2),, (xn,yn,zn)) in order of theirtraversal
Drawbacks: Not space efficient
Coordinates of shared vertices are duplicated
No explicit representation of shared edges and vertices
To drag vertex ?? Find all polygons Edges are drawn twice, cause problem to some devices
Problem in raster display if edges are drawn in opposite
directions (extra pixels may be intensified)
7/31/2019 Curves n Surfaces_1
12/53Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
12
Representing Curves and Surfaces
Advanced Computer Graphics
Pointers to vertex list
Each vertex stored once, in vertex list, V=((x1,y1,z1),
(x2,y2,z2),, (xn,yn,zn))
Polygon is defined as list of indices in the vertex list, P=(2,3,
5,7), e.g. Fig. 11.3
Advantage:
Space is saved, since each vertex is stored once.
Vertex can be changed easily
Drawbacks:
Still difficult to find polygons that share an edge
Shared polygon edges are still drawn twice
7/31/2019 Curves n Surfaces_1
13/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
13
Representing Curves and Surfaces
Advanced Computer Graphics
Pointers to Edge list
Each vertex stored once, in vertex list, V=((x1,y1,z1),(x2,y2,z2),, (xn,yn,zn))
Polygon is not list of vertices but list of edges
Edge points to two vertices, and the list of polygons to which
edge belongs. P=(E1, E2, , En), E=(V1, V2, P1, P2), Fig. 11.4
Advantages:
Earlier all drawbacks are overcomed
Drawbacks: In none of 3 representation, it is easy to determine which
edges are incident to a vertex. (solution: winged-edge
representation)
7/31/2019 Curves n Surfaces_1
14/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
14
Representing Curves and Surfaces
Advanced Computer Graphics
Parametric Cubic Curves
d d C G hi
7/31/2019 Curves n Surfaces_1
15/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
15
Representing Curves and Surfaces
Advanced Computer Graphics
Polylines and polygons are 1st degree piecewise linear
approximations to curves and surfaces. Large no. of points need to be stored to obtain
reasonable accuracy.
Interactive manipulation of data is tedious.
Alternate solution: Use higher degree polynomials
Easy approximation of desired shape
Less storage, Easy interactive manipulation
Ad d C t G hi
7/31/2019 Curves n Surfaces_1
16/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
16
Representing Curves and Surfaces
Advanced Computer Graphics
Higher degree approximations are basedon 3 methods:
Explicit functions
Implicit equations
Parametric representations
Ad n ed Comp te G phi
7/31/2019 Curves n Surfaces_1
17/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
17
Representing Curves and Surfaces
Advanced Computer Graphics
Explicit form: y=f(x) and z=g(x) [or z=f(x,y)] It is impossible to get different yfor singlex, (circlue, ellipse)
Not a rotation invariant representation Difficult to represent curves with vertical tangents
Implicit form: f(x, y, z) = 0 Given equation may have more solution than we want. (how
to represent semicircle?) Difficult to connect two curves in a smooth manner Not efficient for drawing Useful for testing object inside/outside (in previous both),Normals to curves are also easily computed
Parametric: x=x(t), y=y(t), z=z(t) Overcomes problems by earlier two representations Very common in modeling Curve is approximated by piecewise curve segments
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
18/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
18
Representing Curves and Surfaces
Advanced Computer Graphics
Explicit functions:
y = f(x), z = g(x)
impossible to get multiple values for a
single x break curves like circles and ellipses into segments
not invariant with rotation rotation might require further segment breaking
problem with curves with vertical tangents infinite slope is difficult to represent
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
19/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
19
Representing Curves and Surfaces
Advanced Computer Graphics
Implicit equations:
f(x,y,z) = 0
equation may have more solutions than wewant
circle: x + y = 1, half circle: ?
problem to join curve segments together difficult to determine if their tangent directions agree at
their joint point
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
20/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
20
Representing Curves and Surfaces
Advanced Computer Graphics
Parametric representation:
x = x(t), y = y(t), z = z(t)
overcomes problems with explicit and implicitforms
no geometric slopes (which may be infinite)
parametric tangent vectors instead (never infinite)
a curve is approximated by a piecewisepolynomial curve
Cubic polynomials are generally used.
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
21/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
21
Representing Curves and Surfaces
Advanced Computer Graphics
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 curve to interpolateend points
lowest degree that is not planar in 3D
Given a cubic polynomial with it 4 coefficients, 4knowns are used to solve for the unknowncoefficients.
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
22/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
22
Representing Curves and Surfaces
Advanced Computer Graphics
General form of parametric cubic polynomials
that define curve segment Q(t)=[x(t) y(t) z(t)]:
CTtztytxtQ
ddd
ccc
bbb
aaa
CtttT
dtctbtatz
dtctbtaty
dtctbtatx
zyx
zyx
zyx
zyx
zzzz
yyyy
xxxx
)]()()([)(
,]1[
)(
)(
)(
23
23
23
23
where, t[0,1]
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
23/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
23
Representing Curves and Surfaces
Advanced Computer Graphics
Kinds of continuity:
Geometric:
G0: two curve segments join together
G1: directions of tangents are equal at the joint,
i.e. geometric slops are equal at join point Parametric:
C1: directions and magnitudes of tangents are
equal at the joint
Cn: directions and magnitudes of n-th
derivative are equal at the joint
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
24/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
24
Representing Curves and Surfaces
p p
If the tangent vectors of two cubic curve segments
are equal at the join point, the curve has first-
degree continuity, and is said to be C continuous
If the direction and magnitude ofd / dt [Q(t)]through the nth derivative are equal at the join
point, the curve is called C continuous
If the directions (but not necessarily the
magnitudes) of two segments tangent vectors areequal at the join point, the curve has G
continuity
1
n
n n
1
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
25/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
25
Representing Curves and Surfaces
p p
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
26/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
26
Representing Curves and Surfaces
p p
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
Example
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
27/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
27
Representing Curves and Surfaces
Special case:C1 continuity does not imply G1 continuity.When both curves tangent vectors are [0 0 0] at join point.
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
28/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
28
Representing Curves and Surfaces
General form:
GMTtztytxtQ
GMCLet
CTtztytxtQ
ddd
ccc
bbbaaa
CtttT
dtctbtatz
dtctbtaty
dtctbtatx
zyx
zyx
zyx
zyx
zzzz
yyyy
xxxx
)]()()([)(
)]()()([)(
,]1[
)(
)(
)(
23
23
23
23
Where,T=vector of parameter
M= Basis MatrixG= Geometric Vector
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
29/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
29
Representing Curves and Surfaces
A curve segment is defined by constraints on endpoints,
tangent vectors, and continuity between curve segments.
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
B-Spline several kinds, each defined by four control points
uniform B-spline, non-uniform B-spline, other B-splines
Have c1 and c2 continuity at join points,
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
30/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
30
Representing Curves and Surfaces
How the coefficients of cubic polynomials depend
on four constraints:
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
31/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
31
Representing Curves and Surfaces
Hermite Curves
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
32/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
32
Representing Curves and Surfaces
Constraints
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
33/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
33
Representing Curves and Surfaces
Basis Matrix
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
34/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
34
Representing Curves and Surfaces
Blending Functions
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
35/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
35
Representing Curves and Surfaces
')(')32()2()132(
'
'
0001
0010
1323
1212
1)(
1
23
0
23
1
23
0
23
1
0
1
0
23
xttxttxtttxtt
x
x
x
x
ttttX
Hermite Basis (Blending) Functions
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
36/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
36
Representing Curves and Surfaces
36
Hermite Basis (Blending) Functions
x0 x1
x0'
X1
The graph shows the shape of thefour basis functions often called
blending functions.
They are labelled with the elementsof the control vector that they
weight.
Note that at each end only position isnon-zero, so the curve must touch
the endpoints
')(')32()2()132()( 123
0
23
1
23
0
23 xttxttxtttxtttX
R i C d S f
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
37/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
37
Representing Curves and Surfaces
Condition for Continuity
K>0 G1 continuityK=1 C1 continuity
R ti C d S f
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
38/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
38
Representing Curves and Surfaces
Interactive manipulation of end points and tangentsFor two Hermite cubic curve segments
Rep esenting C es and S faces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
39/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
39
Representing Curves and Surfaces
Effect of Changing Magnitudes of Tangent vector at 1st
end point
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
40/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
40
Representing Curves and Surfaces
Effect of Changing Directions of Tangent vector at 1st
end point
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
41/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
41
Representing Curves and Surfaces
Main Drawback:
Requires the specification of the tangents
This information is not always available
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
42/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
42
Representing Curves and Surfaces
Bezier Curves
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
43/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
43
Representing Curves and Surfaces
Bezier Curves
Indirectly specifies end point tangent vector by specifying twointermediate points that are not on the curve.
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
44/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
44
Representing Curves and Surfaces
Generation of Basis Matrix
BBBHBHBHBHHH GMTGMMTGMMTGMTtQ )()()(
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
45/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
45
Representing Curves and Surfaces
Generation of
Basis MatrixAnd
Blending functions
Condition forC0 and C1 continuity
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
46/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
46
p g
Blending Functions
Condition forC0 and C1 continuity
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
47/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
47
p g
Continuity and Convex Hull Property
Examining BB polynomials, we can note that their sum is everywhereUnity and each polynomial is everywhere nonnegative for 0 t 1
Hence, Q(t) is weighted average of four control points.This means,
each curve segment is contained in the convex hull of 4 control points.Convex hull for 2D is convex polygon formed by four control points.
Convex hull property holds true for all cubic whose sum=1 and fn. are non vConvex hull property is useful for clipping curve segment.
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
48/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
48
THINK GOODBE GOOD.
DO GOOD.
HAVE A NICE DAY !!!
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
49/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
49
Generalization of parametric cubic curves.
For each value ofsthere is a family of curves in t.
Major kinds of surfaces:
Hermit, Bezier, B-spline
)()(),( tGMTtCTtsQ
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
50/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
50
50
Summary
Polygon meshes
well suited for representing flat-faced objects
seldom satisfactory for curved-faced objects space inefficient
simpler algorithms
hardware support
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
51/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
51
51
Summary
Piecewise cubic curves and bicubic surfaces
permit multiple values for a single x or y
represent infinite slopes
easier to manipulate interactively
can either interpolate or approximate
space efficient
more complex algorithms little hardware support
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
52/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
52
Parametric bivariate (two-variable)
polynomial surface patches:
point on 3D surface = (x(u,v), y(u,v), z(u,v))
boundaries of the patches are parametric
polynomial curves
many fewer parametric patches than polynomial
patches are needed to approximate a curved
surface to a given accuracy more complex algorithms though
Representing Curves and Surfaces
Advanced Computer Graphics
7/31/2019 Curves n Surfaces_1
53/53
Dr. N.C.Chauhan @ Dept. of Information Technology, ADIT & M.E. Computer Engineering Programme, BVM
53
Parametric polynomial curves:
point on 3D curve = (x(t), y(t), z(t))
x(t), y(t), and z(t) are polynomials usually cubic: cubic curves