Computer Graphics Er. Inderjeet Bal
Computer Graphics Er. Inderjeet Bal
GRAPHICS
Submitted By:
Er. Inderjeet
Bal
Dept. of CS &
IT
TOPICS
• Computer Graphics
• Types of Graphics
• Graphics devices
• Applications of Graphics
• Graphics Packages
• Projections
WHAT IS COMPUTER GRAPHICS?
Scientific Visualization
Producing graphical representations for scientific,
engineering, and medical data sets
7. IMAGE PROCESSING
Example:
x
( x, y )
y
2 . 1
( 2 .1, 4 .8)
4 .8
MATRIX VECTOR
x ' a b x x ' a b c x
y ' c d y
y ' d e f y
z ' g h i z
x ' ax by x ' ax by cz
y ' dx ey fz
y ' cx dy
z ' gx hy iz
1 0 0
1 0
I I 0 1 0
0 1 0 0 1
Matrix * Matrix
2 3 2
A , X
1 5 3
AX ?
2 3 0 .5 1
A , B
1 5 3 2 . 5
A * B ?
A * I ?
TRANSLATION
(x’,y’)
(tx,ty)
(x,y)
TRANSLATION
P ( x, y ) P ( 3 .7 , 4 .1)
Given:
T (t x , t y ) T ( 7 .1,8 .2 )
We want:
x' x t x x ' 3 .7 7 .1
y' y t y y ' 4 .1 8 .2
Matrix form:
x ' x t x x ' 3 . 7 7 . 1
y ' y t y ' 4 . 1 8 . 2
y
P' P T x ' 3 .4
y ' 4 .1
SCALE
(x,y)
Scale
• Given: P ( x , y ) P (1 .4, 2 .2 )
S ( s x , s y ) S (3,3)
x ' 3 0 1 .4
y ' 0 3 2 . 2
x ' s x 0 x
• Matrix y ' 0 s y y x ' 4 .2
form:
P ' S P y ' 6 .6
Rotation
• Rotation - repositions an object
along a circular path.
• Rotation requires an and a pivot
point
Rotation
P=(4,4)
=45 degrees
SPECIFYING 2D TRANSFORMATIONS
Translation
T(tx, ty)
Translation distances
Scale
S(sx,sy)
Scale factors
Rotation
R()
Rotation angle
Combining
Transformations
• Using translate, rotation, and
scale, how do we get:
COMBINING
TRANSFORMATIONS
xh 6
x 3
xh h 4 6 2
x yh 4 3 14
P y h
y Ex. 2 , Ex. 14 7
y h
h 2
1 7
2 2
2
h
h 2
HOMOGENOUS
COORDINATES
x ' 1 0 t x x
x ' t x x
T t x , t y y ' 0 1 t y y
y ' t y y 1 0 0 1 1
P T t x , t y P P T t x , t y P
x ' s x 0 0 x
x ' s x 0 x
S s x , s y y ' 0
sy 0 y
y ' 0 s y y 1 0 0 1 1
P S s x , s y P P S s x , s y P
x ' cos sin 0 x
x ' cos sin x y ' sin
R cos 0 y
y ' sin cos y 1 0 0 1 1
P R P P R P
COORDINATE HIERARCHY
S c re en C oo rd in a tes
T ra n sfo rm a tion
W o rld -> S c re en
• We can have
transformations be in
G re e n
O b je ct's C o o rd in a te s
R ed
O b jec t C o o rd in a tes
T ra n sfo rm a tion
B lu e -> R e d
B lu e
O b jec t C o o rd in a tes
TRANSLATION
ROTATION
ROTATION
ROTATION
SCALING
General definition
Transform points in n-space to m-space(m<n)
In computer graphics
Map viewing coordinates to 2D screen coordinates
TAXONOMY OF PROJECTIONS
Parallel Perspective
Parallel Projection
Perspective Projection
PARALLEL PROJECTION
DOP
View Plane
ORTHOGRAPHIC & OBLIQUE
Front
Top Side
OBLIQUE PROJECTIONS
Cavalier Cabinet
(DOP at 45 ) (DOP at 63.4 )
OBLIQUE PROJECTIONS
OP not perpendicular
tan 1, to view
45 plane
Cavalier projection
Cabinet projection
tan 2 , 63.4
PERSPECTIVE PROJECTION
r s
o
ct
o je
Pr
Center of
View Plane
Projection
PERSPECTIVE PROJECTION
Three-
point
perspectiv
e
PERSPECTIVE PROJECTION
Three- Two-point
point perspectiv
perspectiv e
e
PERSPECTIVE PROJECTION