Computer Graphics Unit 3 Notes
Computer Graphics Unit 3 Notes
1
Introduction
• Graphics scene can contain many various kinds of objects: like trees, water,
rocks, etc.
2
Representing curves and surfaces
• Smooth curves and surfaces must be generated in many computer
– Polygon meshes
– Quadric surfaces.
3
Contd…
Polygon tables:
• edge table : stores the Edge information of each edge of polygon i.e.,
vertex pair for each edge.
• surface table: stores the surface information for each surface i.e., edge list
5
2D & 3D Difference
For 2D for each coordinates or vertices it has two value i.e. X,Y
For 3D for each coordinates or vertices it has three value i.e. X,Y,Z
Contd…
• Consider the surface containing polygonal facets as shown
in figure:
V4
F2i/g9/u2r0e19: Geometric data table representation for two adjacent polygon 6
surfaces.
Contd…
• Polygon meshes: A polygon mesh is collection of edges, vertices and
ways:
– Explicit
9
Contd…
• In explicit representation, each polygon is represented by a list of vertex co-
ordinates.
P x 1 , y 1 , z 1 , x 2 , y 2 , z 2 , . . . . , x n , y n , z n
• There are edges between successive vertices in the list and between the last and
first vertices.
1
0
Continue..
• Representing polygon mesh with each polygon as vertex list.
P1 {v 1 , v 2 ,v 5 }
P2 {v 2 ,v 3 , v 5 }
P3 {v 3 , v 4 ,v 5 } V4
V5
V1 P3
P1
P2
V3
V2
V {v1, v2 , v3 ,......,v n }
{(x 1 , y1, z1 ),(x 2 , y 2 , z 2 ),....,(x 5 , y5 , z5 )}
P1 {1,2,5}
P2 {2,3,5}
P3 {3,4,5}
11
Contd…
• pointers to an edge list:
– This method represent the polygon as a list of pointers to an edge list.
– Each edge in edge list points to the two vertices in the vertex list.
P {E1 , E 2 , E3 ,....,En }
An d an Edge as;
E { v 1 , v 2 , P1 ,
P2 }
14
Contd…
Plane Equations:
– Equation of the plane in which polygon or polygon meshes lies.
surfaces of an object.
15
Contd….
• The equation for a plane surface can be expressed in
the form:
Ax + By + Cz + D = 0
15
Contd…
• Let (x1, y1, z1), (x2, y2, z2) and (x3, y3, z3) are
three
17
Contd…
• The solution of these equations can be obtained in determinant
form using Cramer’s rule as:-
1 y1 z1
A 1 y 2 z 2 ,
1 y 3 z3
x1 1 z1
B x 2 1 z 2 ,
x3
z3
x1 y1 z1
x1
D x 2 y 2 z 2
y1 x 3 y 3 z 3
18
1
Continue..
• Expanding the above matrices so, plane
coefficients are:
A y 1 ( z 2 z 3 ) y 2 ( z 3 z 1 ) y 3 (z 1 z 2 )
B z 1 ( x 2 x 3 ) z 2 ( x 3 x 1 ) z 3 (x 1 x 2 )
C x1 ( y 2 y 3 ) x 2 ( y 3 y1 ) x 3 ( y1 y 2 )
D x 1 ( y 2 z 3 y 3 z 2 ) x 2 ( y 3 z1 y1 z 3 ) x 3 ( y1 z 2
y 2 z1 )
19
Continue..
• For any points (x, y, z);
– If Ax + By + Cz + D ≠0, then (x, y, z) is not on the plane.
• If Ax + By + Cz + D < 0, then (x, y, z) is inside the surface (The side of the
plane that faces the object interior)
• If Ax + By + Cz + D > 0, then (x, y, z) is lies out side the surface (outward
side ).
20
Quadric Surface
• Quadric Surface is one of the frequently used 3D
objects
surface representation.
21
Contd…
1. Sphere:
For the set of surface points (x, y, z) the spherical surface is
represented as: x2+y2+z2 = r2, with radius r and centered at
co-ordinate origin.
2.
Ellipsoid:
x2 y2 z 2
a2 b2 c2 1
where (x, y, z) is the surface points and a, b, c are the
radii on X, Y and Z directions respectively.
22
Contd….
3. Elliptic Paraboloid
2
2 y
x z
2 2
a b
4. Hyperbolic Paraboloid
2
2 y
x z
2 2
a b
2
5. Elliptic Cone x2 y
2
0
z
a2 b2 c2 22