0% found this document useful (0 votes)
69 views14 pages

In Graphics, Once We Have An Object Described, Transformations Are Used To Move That Object, Scale It and Rotate It

The document discusses various transformations that can be applied to objects in graphics, including translation, scaling, and rotation. It introduces homogeneous coordinates as a way to represent transformations using matrix multiplication, allowing multiple transformations to be combined into a single matrix. Key matrix forms are presented for translation, scaling, and rotation in the homogeneous coordinate system.

Uploaded by

B.Tulasi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views14 pages

In Graphics, Once We Have An Object Described, Transformations Are Used To Move That Object, Scale It and Rotate It

The document discusses various transformations that can be applied to objects in graphics, including translation, scaling, and rotation. It introduces homogeneous coordinates as a way to represent transformations using matrix multiplication, allowing multiple transformations to be combined into a single matrix. Key matrix forms are presented for translation, scaling, and rotation in the homogeneous coordinate system.

Uploaded by

B.Tulasi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

 In graphics, once we have an object described,

transformations are used to move that object,


scale it and rotate it

B.Tulasi, Dept Of CS,Christ University 1


Bangalore
Translation
Simply moves an object from one position to
another
 xnew = xold + dx ynew = yold + dy

y 6

0
1 2 3 4 5 6 7 8 9 10
x
Note: House shifts position relative to origin
B.Tulasi, Dept Of CS,Christ University 2
Bangalore
Scaling
 xnew = Sx × xold ynew = Sy × yold

y
6

3 6  9
 3 3
   
2

1  2 3
1  1
   
0
1 2 3 4 5 6 7 8 9 10
x
Note: House shifts position relative to origin

B.Tulasi, Dept Of CS,Christ University 3


Bangalore
Rotation
Rotates all coordinates by a specified angle
 x
new = xold × cosθ – yold × sinθ
 y
new = xold × sinθ + yold × cosθ
Points are always rotated about the origin

y
6

2


1 6

0
1 2 3 4 5 6 7 8 9 10
x

B.Tulasi, Dept Of CS,Christ University 4


Bangalore
Homogeneous Coordinates
Apoint (x, y) can be re-written in
homogeneous coordinates as (xh, yh, h)
The homogeneous parameter h is a non-
zero value such that:

We can then write any point (x, y) as (hx, hy, h)


We can conveniently choose h = 1 so that
(x, y) becomes (x, y, 1)
B.Tulasi, Dept Of CS,Christ University 5
Bangalore
Why Homogeneous Coordinates?
Mathematicians commonly use homogeneous
coordinates as they allow scaling factors to be
removed from equations
We will see in a moment that all of the

transformations we discussed previously can be


represented as 3*3 matrices
Using homogeneous coordinates allows us use

matrix multiplication to calculate


transformations – extremely efficient!

B.Tulasi, Dept Of CS,Christ University 6


Bangalore
Homogeneous Translation

The translation of a point by (dx, dy) can be
written in matrix form as:
 1 0 dx 
 0 1 dy 
 
 0 0 1 
Representing the point as a homogeneous

column vector we perform the calculation as:

1 0 dx x 1* x  0* y  dx*1 x  dx


0 1 dy y  0* x 1* y  dy*1  y  dy
       
0 0 1  1   0* x  0* y 1*1   1 
B.Tulasi, Dept Of CS,Christ University 7
Bangalore
Homogenous Coordinates
To make operations easier, 2-D points are
written as homogenous coordinate column
vectors

1 0 dx   x   x  dx 
0 1 dy    y    y  dy  : v'  T (dx, dy )v
Translation:      
0 0 1  1   1 

sx 0 0 x sx  x


0 sy 0 y  sy  y : v'  S(sx, sy)v
Scaling:
     
0 0 1 1   1 
B.Tulasi, Dept Of CS,Christ University 8
Bangalore
Homogenous Coordinates (cont…)

Rotation:

cos   sin  0  x  cos   x  sin   y 


 sin  cos  0   y   sin   x  cos   y  : v'  R( )v

 0 0 1 1   1 

B.Tulasi, Dept Of CS,Christ University 9


Bangalore
Inverse Transformations
Transformations can easily be reversed using
inverse transformations

1 0  dx
1   1 
T  0 1  dy  s 0 0
0 0 1  x 
1  1 
S  0 0
 cos sin 0  sy 
1    0 0 1
R  sin cos 0  
 0  
0 1
B.Tulasi, Dept Of CS,Christ University 10
Bangalore
Combining Transformations
A number of transformations can be combined
into one matrix to make things easy
◦ Allowed by the fact that we use homogenous
coordinates
Imagine rotating a polygon around a point
other than the origin
◦ Transform to centre point to origin
◦ Rotate around origin
◦ Transform back to centre point

B.Tulasi, Dept Of CS,Christ University 11


Bangalore
Combining Transformations
House (H ) T ( dx, dy ) H
1 2

R ( )T ( dx , dy ) H T (  dx, dy ) R ( )T ( dx, dy ) H

3 4
B.Tulasi, Dept Of CS,Christ University 12
Bangalore
Combining Transformations
Thethree transformation matrices are
combined as follows
1 0  dx cos  sin 0 1 0 dx  x 
0 1  dy  sin cos 0  0 1 dy   y
       
0 0 1   0 0 1 0 0 1  1 

v'  T (dx,dy)R( )T (dx, dy)v

REMEMBER: Matrix multiplication is not


commutative so order matters
B.Tulasi, Dept Of CS,Christ University
Bangalore
13
Composite Transformations
 Translation
◦ For two successive translation (tx1,ty1) and
(tx2,ty2) are applied to a corodinate position P the
final tranformed location P` is calculated as
T(tx1,ty1).{T(tx2,ty2).P}
 Rotation
◦ R(θ2).{R(θ1).P}
 Scaling
◦ S(sx1,sy1).s

B.Tulasi, Dept Of CS,Christ University 14


Bangalore

You might also like