Professional Documents
Culture Documents
Graphics Chap 11 Foley 2021
Graphics Chap 11 Foley 2021
• There are edges between successive vertices and between the last and the first
vertex in the list.
• For a single polygon, this is space efficient, but for a polygon mesh, much space
is lost coz the coordinates of shared vertices are duplicated.
• There is no explicit representation of shared vertices and edges, so finding one
requires comparing each of the coordinate triples of one polygon with all others.
• In this representation, for drawing a mesh, we first have to check for shared
edges, coz otherwise each shared edge will be drawn twice and it might cause
problems.
2). Pointer to a vertex list: Store all vertices once into a numbered list, and
represent each polygon by its vertices. For eg. A polygon P made up of vertices
1,3, 4, 5 is represented as follows:
V=(V1,V2,V3,V4,V5,V6)= ((x1,y1,z1),(x2,y2,z2),(x3,y3,z3),(x4,y4,z4),(x5,y5,z5),(x6,y6,z6))
• Since the coordinates of each vertex are stored only once, there is a considerable
saving of space.
• Coordinates of a vertex can be changed easily in this representation as
compared to the explicit representation.
• However it is still difficult to find polygons that share an edge.
• Shared polygon edges will still be drawn twice if care is not taken.
3). Pointers to an edge list (explicit-edge): We again have a vertex list V, and
each polygon is represented as a list of edges, in which each edge can occur
only once. Each edge in the edge list points to two of the vertices in the vertex list
defining the edge, and also to one or two of the polygons to which the edge
belongs. For eg.
V=(V1,V2,V3,V4)= ((x1,y1,z1),(x2,y2,z2),(x3,y3,z3),(x4,y4,z4))
E1 = (V1,V2,P1,λ)
V2
E2 = (V2,V3,P2,λ) E
2
E3 = (V3,V4,P2,λ) E 1
E4 V3
E4 = (V4,V2,P1, P2) V 1
P1 P2
E E3
E5 = (V4,V1,P1,λ) 5
V4
P1 = (E1,E4,E5)
P2 = (E2,E3,E4)
• Consistency of Polygon-mesh Representations – at times we requires the
polygons to follow some consistency, say to
– make sure all polygons are closed.
– All edges are used at least once but not more than some maximum.
– Each vertex is referenced at least once.
– Mesh to be completely connected (any vertex can be reached from any other
vertex).
– To have no holes (there exist one boundary, a connected sequence of edges,
each of which is used by one polygon)
• Of the three representations, the explicit edge scheme is the easiest to check for
consistency, because it contains the most information.
• Plane Equations
Ax + By + Cz + D = 0
• Given points P1, P2 and P3 on the plane, plane’s normal can be computed as the
vector cross product P1P2 X P2P3. If the cross product is zero, then the three
points are collinear and do not define the plane.
• We can find the perpendicular distance d from the plane to each vertex (x,y,z) as:
d = (Ax + By + Cz + D) / (A2 + B2 + C2)1/2
• Also this distance is positive or negative, depending on which side of the plane
the point lies. If the vertex is on the plane, then d=0.
(x1, y1 )
(x3, y3)
A3
A1
A2 (x2, y2)
0<=t<=1
Written in matrix form, it becomes
Q(t)= [x(t) y(t) z(t)] = T⋅ C
where
The derivative of Q(t) is the parametric tangent vector of the curve. Applying
the definition to the curve’s equation, we have
Q(t) =
• Multiplying out only x(t) = T.M.Gx
x(t) = (t3m11 + t2m21 + t m31 + m41)g1x + (t3m12 + t2m22 + t m32 + m42)g2x +
(t3m13 + t2m23 + t m33 + m43)g3x + (t3m14 + t2m24 + t m34 + m44)g4x
The above equation emphasizes that the curve is a weighted sum of the elements of
the geometry matrix. The weights are each cubic polynomial of t, and are called
blending functions. The blending function B is given by B= T.M
Hermite curves
• Hermite curves are determined by the two endpoints P1, P4 and tangent vectors
at the endpoints R1, R4.
Expanding the product T. MH in Q(t)=T. MH. GH gives the hermite blending function BH
Q(t) = T. MH. GH = BH. GH
For two hermite cubics to share a common endpoint with G1 continuity, the geometry
vectors must have the form :
x(t)
Bezier Curves
• Uses 2 end points and two intermediate points which are not on the curve,
P1,P2,P3,P4.
• Starting and ending tangent vectors are specified indirectly as:
R1 = Q’(0) = 3(P2-P1) and R4 = Q’(1) = (P4 – P3)
GB =
Bezier Basis matrix MB, is given as:
MB =
• In the four berstein polynomials BB ,the sum is everywhere unity and also each
polynomial is everywhere nonnegative for 0<=t<1. Thus Q(t) is weighted average
of the four control points. This condition means that each curve segment, which is
just the sum of four control points weighted by the polynomials, is completely
contained in the convex hull of the four control points.
• knots • Control points
control points that lie on the a set of points that influence
curve the curve's shape
• Interpolating spline
curve passes through the knots • Approximating spline
control points merely influence
shape
Uniform Nonrational B-Splines (only definition)
• Natural cubic spline, is a C0,C1 and C2 continuous cubic polynomial that
interpolates the control points. This is 1 more degree of continuity than is inherent
in hermite and bezier curves. Thus, splines are inherently more smoother than
hermite and bezier curves.
• The polynomial coefficients for natural cubic splines are dependent on all n
control points; their calculation involves inverting an n+1 by n+1 matrix.
• This has two disadvantages:
– Moving any one control point effects the entire curve.
– Too much computation time is needed to invert the matrix.
• B-splines, consists of curve segments whose polynomial coefficients depend on
just a few control points. This is called local control. Thus, moving a control point
affects only a small part of the curve.
• B-splines have the same continuity as the natural splines but do not interpolate
their control points.
• Cubic B-Spline approximate a curve with m+1 control points: P0, P1,…,Pm,
where m >= 3, with a curve consisting of m-2 connected, cubic polynomial, curve
segments, Q3 to Qm.
• The curve segments Qi-1 and Qi join at knots, at the parameter value ti .
• The parameter value is called the knot value.
• Endpoints of the entire curve are also called knots. There is a total of m-1 knots.
• Each of the m-2 curve segments of a B-spline curve is defined by four of the m+1
control points. In particular, curve segment Qi is defined by points Pi-3, Pi-2, Pi-1,
and Pi.
t10
t9
t5 t6
t3 t8
t7
t4
Control points
knots
• The term uniform means that the knots are spaced at equal intervals of the
parameter t.
• The term nonrational is used to distinguish these splines from rational cubic
polynomial curves, where x(t),y(t) and z(t) are each defined as ratio of two cubic
polynomials.
• The term B stands for basis.
• B-spline geometry vector GBsi for segment Qi is
GBsi = 3<=i<=m
• Just as each curve segment is defined by four control points, each control point
influences four curve segments. Moving a control point in a given direction moves
the four curve segments it affects in the same direction, the other curve segments
are totally unaffected. This is local control property of B-splines.
• Equation of B-spline curve segment i is
Qi(t) = Ti . MBs . GBsi
• Ti is a row vector [(t - ti)3 (t - ti)2 (t - ti) 1 ]
• The B-spline basis matrix, MBs is
MBs = 1/6
Nonuniform, Nonrational B-Splines
• Nonuniform coz the parameter value between successive knot values need not be
uniform. The nonuniform knot-value sequence means that the blending functions
are no longer the same for each interval, but rather vary from curve segment to
curve segment.
• These curve segments have several advantages over uniform B-splines:
– Continuity of join points can be reduced from C2 to C1 to C0 to none. If the
continuity is reduced to none, then the curve interpolates a control point, but
without the effect of uniform B-splines, where the curve segments on either
side of the control point are straight lines.
– The starting and ending points can be interpolated exactly, without introducing
straight line segments.
– It is possible to add an additional knot and control point so that the resulting
curve can be easily reshaped, whereas this cannot be done with uniform
B-splines.
• The knot-value sequence is a non-decreasing sequence of knot values t0
through tm+4(i.e. there are four more knots than there are control points). Thus the
curve with smallest number of control points is 4 and has 8 knot values.
• The knot-value sequence has to be non-decreasing, i.e. they can be equal. When
this occurs, the parameter value is called a multiple knot and the number of
identical parameter values is called the multiplicity of the knot. For instance, in
the knot sequence (0,0,0,0,1,1,2,3), knot value 0 has multiplicity 4, knot value 1
has multiplicity 2, knot value 2 has multiplicity 1, and knot value 3 also has
multiplicity 1.
Nonuniform, Rational Cubic Polynomial Curve Segments
• One of the disadvantages of the curves discussed till now is that they cannot be
used to create common conic shapes such as circles, ellipses, parabolas, etc.
This can be done using rational cubic curves, however.
• Defining curves as rational polynomials in this manner allows for simple exact
representations of conic sections such as circles, as well as curves which are
invariant under perspective projection.
• Nonuniform, Rational B-splines are called NURBS.
• Rational curves are useful for two reasons:
– They are invariant under rotation, scaling, translation and perspective
transformations of the control points, whereas nonrational curves are only
invariant under rotation, scaling and translation.
– Can be used to create common conic shapes such as circles, ellipses,
parabolas, etc.
Subdividing Curves
• There are two ways to increase the number of control points:
– Degree elevation – the degree of splines is increased from 3 to 4 or more.
This adjustment is necessary if higher orders of continuity is required, but
otherwise this method will increase the computational time needed.
– Subdivide – we can increase the number of control points by subdividing the
curve segment into two segments. For example, a bezier curve segment with
four control points can be subdivided into two segments with total of seven
control points.
P2 H
P3
L3
R2
L4 = R1
L2
R3
P 1 = L1 P4 = R 4
• Given a bezier curve Q(t) defined by points P1, P2, P3 and P4, we want to find a
left curve defined by points L1,L2,L3,L4 and right curve defined by R1,R2,R3,R4,
such that for the left curve 0<=t<1/2 and for right curve ½<=t<1
• Every subdivision divides the line in the ration t:(1-t)
• Say if t=1/2, then H = (P2+P3)/2,
L2=(P1+P2)/2, L3=(L2+H)/2, R3=(P3+P4)/2,
R2=(H+R3)/2, L4=R1=(L3+R2)/2
Conversion Between Representations
• Given a curve represented by geometry vector G1 and basis matrix M1, we want
to find the equivalent geometry matrix G2 for basis matrix M2 such that the two
curves are identical:
T . M2 . G2 = T . M1 . G1
this can be rewritten as
M2 . G2 = M1 . G1
solving for G2, the unknown geometry matrix:
multiply both sides by M2-1 gives
=> M2-1 . M2 . G2 = M2-1 . M1 . G1
=> G2 = M2-1 . M1 . G1
=> G2 = M12 . G1 where M12 = M2-1 . M1
As an example, in converting from B-spline to bezier form,
• Now using the forward differences in an algorithm that iterates from n=0 to nδ=1
f0 = d,
Δf0 = aδ3 + bδ2 + cδ
Δ2f0 = 6aδ3 + 2bδ2
Δ3f0 = 6aδ3