Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Subject - Computer Graphics (22318)

Unit 3 (Topic 1)

- By Nitin Pawar Sir


U – 3 Overview of Transformations
3.1 2D Transformations
3.2 Matrix representations &
Homogeneous co-ordinates
3.3 Composite Transformations
3.4 3D Transformations
3.5 Types of Projections
3.1 2D Transformations
What is transformations?
◦ The geometrical changes of an object from a
current state to modified state.
Why the transformations is needed?
◦ To manipulate the initially created object and
to display the modified object without having
to redraw it.
3.1….
2 ways
◦ Object Transformation
 Alter the coordinates descriptions an object
 Translation, rotation, scaling etc.
 Coordinate system unchanged
◦ Coordinate transformation
 Produce a different coordinate system
3.1....
Why do we use matrix?
◦ More convenient organization of data.
◦ More efficient processing
◦ Enable the combination of various
concatenations
Matrix addition and subtraction
c a c
a
 = b d
b d
3.1.1 Translation
 A translation moves all points
in an object along the same
straight-line path to new
positions.
 The path is represented by a ?
vector, called the translation or
shift vector.
 We can write the components: ty=4
x’ = x + tx
y' = y + ty (2, 2) tx = 6
 or in matrix form:
P' = P + T
x’ x tx
y’ = y +
ty
3.1.2 Rotation
A rotation repositions
all points in an object
along a circular path in P’
the plane centered at
the pivot point. 

P
First,we’ll assume the
pivot is at the origin.
3.1.2….
• Review Trigonometry
=> cos  = x/r , sin = y/r
• x = r. cos , y = r.sin 
P’(x’, y’)

=> cos (+ ) = x’/r


• x’ = r. cos (+ ) 
• x’ = r.coscos -r.sinsin r
• x’ = x.cos  – y.sin  y’ P(x,y)

 r
=>sin (+ ) = y’/r y

y’ = r. sin (+ )
• y’ = r.cossin + r.sincos x’ x
• y’ = x.sin  + y.cos 
Identity of Trigonometry
3.1.2….
• We can write the components:
x' = x cos  – y sin 
y' = x sin  + y cos 

P’(x’, y’)
• or in matrix form:
P' = R • P
•  can be clockwise (-ve) or 
counterclockwise (+ve as our
example). y’
P(x,y)
• Rotation matrix
 r
y
cos  sin   
R
 sin  cos  x
x’
3.1.2….
Example
◦ Find the transformed point, P’, caused by
rotating P= (5, 1) about the origin through an
angle of 90.
cos  sin   x   x  cos  y  sin 
 sin  
 cos   y   x  sin  y  cos 

5  cos 90  1 sin 90


 
5  sin 90  1 cos 90

5  0  11
 
5 1  1 0
 1
 
5
3.1.3 Scaling
• Scaling changes the size of an object and
involves two scale factors, Sx and Sy for
the x- and y- coordinates respectively. P’
• Scales are about the origin.
• We can write the components:
x' = x * sx
y' = y * sy
or in matrix form:
P' = S • P P
Scale matrix as:

sx 0
S
0 s y 
3.1.3....
• If the scale factors are in between 0 and 1  the
points will be moved closer to the origin  the
object will be smaller.

• Example :
• P(2, 5), Sx = 0.5, Sy = 0.5
• Find P’ ?
P(2, 5)

P’
3.1.3....
• If the scale factors are in between 0 and 1  the
points will be moved closer to the origin  the P’
object will be smaller.

• Example :
• P(2, 5), Sx = 0.5, Sy = 0.5
• Find P’ ?
P(2, 5)

•If the scale factors are larger than 1  the points


will be moved away from the origin  the object P’
will be larger.
• Example :
• P(2, 5), Sx = 2, Sy = 2
• Find P’ ?
3.1.3....
P’
• If the scale factors are the same, Sx = Sy 
uniform scaling
• Only change in size (as previous example)

•If Sx  Sy  differential scaling.


•Change in size and shape
•Example : square  rectangle
• P(1, 3), Sx = 2, Sy = 5 , P’ ? P(1, 2)
3.1.4 Reflection
Transformation that produces a mirror image of an object
1. Reflection About x-axis 2.Reflection About y-axis

1 0 0
0  1 0
 
0 0 1

 1 0 0
 0 1 0
 
 0 0 1
3.1.4….
3. About origin 4. About line x=y
 1 0 0 0 1 0
 0  1 0 1 0 0
   
 0 0 1 0 0 1
3.1.4….
5. About line y=-x
3.1.5 Shear
- Transformation that Slants shape of an
object,
y x- shear y-shear

x
Fig. a) Original object Fig. b) Object after Fig. c) Object after
without shear x-shear y-shear
3.1.5 ….
1. x- shear 2. y-shear

1 shx 0 1 0 0
0 1 0 sh
  y 1 0
0 0 1  0 0 1

x'  x  shx  y x'  x


y'  y y '  y  shy  x
Thank
you....

You might also like