0% found this document useful (0 votes)
184 views18 pages

Transformation Problems

Homogenous coordinates allow points in 2D space to be represented using 3D coordinate systems, enabling all geometric transformations to be represented as matrix multiplications. A point (x,y) can be converted to homogeneous coordinates (x,y,w). Composite transformations, involving multiple transformations applied in sequence, can be represented as a single transformation matrix produced by concatenating the individual transformation matrices. Rotations and scalings of 2D objects can then be achieved by applying the appropriate transformation matrices to the homogeneous coordinates.

Uploaded by

rajya lakshmi
Copyright
© © All Rights Reserved
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)
184 views18 pages

Transformation Problems

Homogenous coordinates allow points in 2D space to be represented using 3D coordinate systems, enabling all geometric transformations to be represented as matrix multiplications. A point (x,y) can be converted to homogeneous coordinates (x,y,w). Composite transformations, involving multiple transformations applied in sequence, can be represented as a single transformation matrix produced by concatenating the individual transformation matrices. Rotations and scalings of 2D objects can then be achieved by applying the appropriate transformation matrices to the homogeneous coordinates.

Uploaded by

rajya lakshmi
Copyright
© © All Rights Reserved
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/ 18

Homogenous Coordinates

 To perform a sequence of transformations


Example:
 translation followed by rotation and scaling -
 Translate the coordinates,
 Rotate the translated coordinates, and then
 Scale the rotated coordinates to complete the composite transformation.
 To shorten this process, we have to use 3×3 transformation matrix instead of 2×2
transformation matrix. To convert a 2×2 matrix to 3×3 matrix, we have to add an extra
dummy coordinate W.
 Representation of the point by 3 numbers instead of 2 numbers, is
called Homogenous Coordinate system
 In this system, we can represent all the transformation equations in matrix
multiplication. Any Cartesian point P(X,Y) can be converted to homogenous
coordinates by P’ (X, Y, h).
Composite Transformation
 If a transformation of the plane T1 is followed by a second plane transformation T2,
then the result itself may be represented by a single transformation T which is the
composition of T1 and T2 taken in that order
 Composite transformation can be achieved by concatenation of transformation
matrices to obtain a combined transformation matrix.
 [T][X] = [Tn] …. [T4] [T3] [T2] [T1] [X]
 Where [Ti] is any combination of
 Translation
 Scaling
 Shearing
 Rotation
 Reflection
 The change in the order of transformation would lead to different results,
as in general matrix multiplication is not cumulative, that is [A][B] ≠ [B][A]
and the order of multiplication
 The basic purpose of composing transformations is to gain efficiency by
applying a single composed transformation to a point, rather than
applying a series of transformation, one after another.
Problems:
Given a square object with coordinate points A(0, 3), B(3, 3), C(3, 0), D(0, 0). Apply the
scaling parameter 2 towards X axis and 3 towards Y axis and obtain the new coordinates
of the object.

For homogeneous coordinates, the scaling matrix may be represented as a 3 x 3 matrix


as-
Solution-
 Given-

•Old corner coordinates of the square = A (0, 3), B(3, 3), C(3, 0), D(0, 0)
•Scaling factor along X axis = 2
•Scaling factor along Y axis = 3
 
For Coordinates A(0, 3)

 Let the new coordinates of corner A after scaling = (Xnew, Ynew).


 Applying the scaling equations, we have-
•Xnew = Xold . Sx = 0  x 2 = 0
•Ynew = Yold . Sy = 3 x 3 = 9 
Thus, New coordinates of corner A after scaling = (0, 9). 
For Coordinates B(3, 3)
 Let the new coordinates of corner B after scaling = (Xnew, Ynew).
 Applying the scaling equations, we have-
•Xnew = Xold . Sx = 3  x 2 = 6
•Ynew = Yold . Sy = 3 x 3 = 9
 Thus, New coordinates of corner B after scaling = (6, 9).
 For Coordinates C(3, 0)
 Let the new coordinates of corner C after scaling = (Xnew, Ynew).
 Applying the scaling equations, we have-
•Xnew = Xold . Sx = 3  x 2 = 6
•Ynew = Yold . Sy = 0 x 3 = 0
 Thus, New coordinates of corner C after scaling = (6, 0).
For Coordinates D(0, 0)
 Let the new coordinates of corner D after scaling = (Xnew, Ynew).
 Applying the scaling equations, we have-
•Xnew = Xold x Sx = 0  x 2 = 0
•Ynew = Yold x Sy = 0 x 3 = 0
 Thus, New coordinates of corner D after scaling = (0, 0).
 Thus, New coordinates of the square after scaling = A (0, 9), B(6, 9),
C(6, 0), D(0, 0).
2D Rotation in Computer Graphics-
 

In Computer graphics,
2D Rotation is a process of rotating an object with respect to an angle in a two
dimensional plane.

Given a line segment with starting point as (0, 0) and ending point as (4, 4). Apply 30-
degree rotation anticlockwise direction on the line segment and find out the new
coordinates of the line.
 
Solution-
 We rotate a straight line by its end points with the same angle. Then, we re-draw a line between the
new end points.
 Given-
•Old ending coordinates of the line = (Xold, Yold) = (4, 4)
•Rotation angle = θ = 30º
 Let new ending coordinates of the line after rotation = (Xnew, Ynew).
 Applying the rotation equations, we have-
 Xnew = Xold cosθ – Yold sinθ
= 4.cos30º – 4.sin30º = 4 x (√3 / 2) – 4 x (1 / 2) = 2√3 – 2= 2(√3 – 1)= 2(1.73 – 1)= 1.46
 Ynew = Xold x sinθ + Yold x cosθ
= 4 x sin30º + 4 x cos30º = 4 x (1 / 2) + 4 x (√3 / 2) = 2 + 2√3 = 2(1 + √3) = 2(1 + 1.73) = 5.46
 Thus, New ending coordinates of the line after rotation = (1.46, 5.46).
Alternate
Method

Thus, New ending coordinates of the line after rotation = (1.46, 5.46).
Given a triangle with corner coordinates (0, 0), (1, 0) and (1, 1). Rotate the triangle by 90-degree
anticlockwise direction and find out the new coordinates.
 Solution-
 We rotate a polygon by rotating each vertex of it with the same rotation angle.
 Given-
•Old corner coordinates of the triangle = A (0, 0), B(1, 0), C(1, 1)
•Rotation angle = θ = 90º
 For Coordinates A(0, 0)
 Let the new coordinates of corner A after rotation = (Xnew, Ynew).
 Applying the rotation equations, we have-
 Xnew= Xold .cosθ – Yold .sinθ = 0 .cos90º – 0 .sin90º = 0 
Ynew = Xold .sinθ + Yold .cosθ = 0 .sin90º + 0 .cos90º = 0 Thus, New coordinates of corner
A after rotation = (0, 0).
 For Coordinates B(1, 0)
 Let the new coordinates of corner B after rotation = (Xnew, Ynew).
 Xnew = Xold .cosθ – Yold .sinθ = 1 .cos90º – 0 .sin90º = 0
 Ynew = Xold .sinθ + Yold .cosθ = 1 .sin90º + 0 .cos90º = 1 + 0 = 1
 Thus, New coordinates of corner B after rotation = (0, 1).
For Coordinates C(1, 1)
 Let the new coordinates of corner C after rotation = (Xnew, Ynew).
 Xnew = Xold x cosθ – Yold x sinθ = 1 x cos90º – 1 x sin90º = 0 – 1 = -1
 Ynew = Xold x sinθ + Yold x cosθ = 1 x sin90º + 1 x cos90º = 1 + 0 = 1

 Thus, New coordinates of corner C after rotation = (-1, 1).


 Thus, New coordinates of the triangle after rotation = A (0, 0), B(0, 1), C(-1, 1).
Rotation About an Arbitrary point

 Translate point ‘P’ to ‘O’ the origin


 Rotate object by given Angle
 Translate point Back to original Position

The transformation matrices for above positions are in


the following Sequence
Problem on composite Transformation
The vertices of a triangle are situated at points (15,30), (25,35) and (5,46). Find the
coordinates of the vertices if the triangle is rotated by 300 in a counterclockwise direction
about its centroid.

15+ 25+5 30+35+ 46


 
Centroid of a triangle, C =
( 3
,
3
=(15,37) )
 Translate point ‘C’ to ‘O’ the origin
 Rotate object by given Angle
 Translate point Back to original Position
  1 0 −𝑡 𝑥 𝑐𝑜𝑠 𝜃 − 𝑠𝑖𝑛 𝜃 0   1 0 𝑡𝑥

[ ] [ ]
 
𝑇1= 0
0
1
0
− 𝑡𝑦
1 [
𝑇 2 = 𝑠𝑖𝑛 𝜃
0
𝑐𝑜𝑠 𝜃
0
0
1 ] 𝑇3= 0
0
1
0
𝑡𝑦
1

Where tx=15, ty=37 and θ=300

The Required Transformation Matrix is given by [T]= [T3][T2][T1]

  1 0 𝑡𝑥 𝑐𝑜𝑠 𝜃 − 𝑠𝑖𝑛 𝜃 0 1 0 −𝑡𝑥


[𝑇 ]= 0
0 [ 1
0
𝑡𝑦
1 ][ 𝑠𝑖𝑛 𝜃
0
𝑐𝑜𝑠 𝜃
0 ][
0 0
1 0
1
0
−𝑡𝑦
1 ]
  1 0 15 𝑐𝑜𝑠 30 − 𝑠𝑖𝑛 30 0 1 0 −15  0.866 −0.5 20.51
¿ 0
0 [ 1
0
37
1 ][𝑠𝑖𝑛 30
0
𝑐𝑜𝑠 30
0 ][
0 0
1 0
1
0
−37
1 ][ ¿ 0.5
0
0.866
0
−2.54
1 ]
Final points are
0.866
  − 0.5 20.51 15
T.A ¿ 0.5
0 [ 0.866
0 ][ ]
− 2.54 30
1 1

0.866
  −0.5 20.51 25
T.B ¿ 0.5
0 [ 0.866
0
− 2.54
1 ][ ]
35
1

 0.866 −0.5 20.51 5


T.C ¿ 0.5
0 [ 0.866
0
−2.54
1 ][ ]
46
1
Given a point P(1, 3, -5). Find
(i) The transformed point P* if P is translated by d= 2i+3j-4k and then rotated by 30o
about the Z-axis.
(ii) Same as in (i) but point P is rotated first, then translated.
Solution:
Transformations involved for (i) Transformations involved for (ii)
i) Translation by ‘d’ i) Translation to origin
ii) Translation to origin ii) Rotation by 300
iii) Rotation by 300 iii) Translation to the original position.
iv) Translation to the original position. iv) Translation by ‘d’

  𝑐𝑜𝑠 30 − 𝑠𝑖𝑛 30 0  Translation Matrix =


Rotation matrix=
[ 𝑠𝑖𝑛 30
0
𝑐𝑜𝑠 30
0
0
1 ]

You might also like