Professional Documents
Culture Documents
Computer Graphics and Visualization: Module-2
Computer Graphics and Visualization: Module-2
Module-2
Fill area Primitives, 2D Geometric Transformations and 2D viewing
C.K.SRINIVAS
Associate Professor
Dept. of CS&E
BITM, Ballari.
Cell: 9886684832
Email: srinivasck9@gmail.com
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
polygon
Polygon Classifications
interior angle
convex.
concave
FIGURE 2-1
2
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
FIGURE 2-2
vector
method
V V
E V V
FIGURE 2-3
E E
E E
E E
3
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
E E
E E E E
E E E E
E E E E
E E
E
Inside-Outside Tests
odd-even rule,
P
P P
winding number.
P
P
P P
P
4
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
FIGURE 2-4
Polygon Tables
FIGURE 3-5
5
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
Plane Equations
6
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
7
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
normal vector
GL_POLYGON
glBegin
glVertex GL POLYGON
8
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
GL_TRIANGLES
GL_TRIANGLE_STRIP
9
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
GL_TRIANGLE_FAN
glBegin (GL_TRIANGLE_FAN);
glVertex2iv (p1);
glVertex2iv (p2);
glVertex2iv (p3);
glVertex2iv (p4);
glVertex2iv (p5);
glVertex2iv (p6);
glEnd ( );
GL_QUADS
glBegin (GL_QUADS);
glVertex2iv (p1);
glVertex2iv (p2);
glVertex2iv (p3);
glVertex2iv (p4);
glVertex2iv (p5);
glVertex2iv (p6);
glVertex2iv (p7);
glVertex2iv (p8);
glEnd ( );
FIGURE 3-57
GL QUADS
GL_QUAD_STRIP
glBegin (GL_QUAD_STRIP);
glVertex2iv (p1);
glVertex2iv (p2);
glVertex2iv (p4);
glVertex2iv (p3);
glVertex2iv (p5);
glVertex2iv (p6);
glVertex2iv (p8);
glVertex2iv (p7);
glEnd ( );
FIGURE 3-57 GL QUAD STRIP
10
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
F I G U R E 3.58
Interior pixels along a scan line passing through a polygon fill area.
11
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
F I G U R E 3-59
12
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
13
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
14
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
15
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
F I G U R E 3-61 A polygon and its sorted edge table, with edge DC shortened by one unit in the y direction
16
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
Translation
= +
Scaling
17
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
•
•
•
•
•
= *
Rotation:
18
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
= *
19
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
Composite Transformations
Translation
Rotations
20
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
Scaling
OR
S S S
FIGURE: R
21
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
1.
2.
3.
or
T x f yf • • •S• sx sy • T
• • •x f • •yf • • S
• • x f yf sx sy
22
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
Other Transformations
Reflection
F I G U R E:
23
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
24
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
Shearing
•
•
•
•
•
= *
25
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
A viewing transformation using standard rectangles for the window and viewport
26
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
glMatrixMode (GL_PROJECTION);
glLoadIdentity ( );
gluOrtho2D
27
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
xvmin yvmin
28
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.
Module – 2: Fill area Primitives, 2D Geometric Transformations and 2D viewing
Questions
Sl.No Module – 2: Marks
4 Define Polygon Tables. Explain How Geometric data is represented for the objects in a 10
scene. Give example.
7 Define the following two dimensional transformations Translation, Rotation, Scaling, and 10
Reflection (Dec 09/Jan 10)
9 Explain the current transformation matrix (CTM) in OpenGL ( Dec 09/Jan 10) Or Explain 08
how rotation, translation & scaling is considered in OpenGL Current Transformation Matrix
(CTM)
29
C.K.SRINIVASA, Asso. Prof. Dept Of CS&E, BITM, BALLARI.