0% found this document useful (0 votes)
22 views57 pages

Lecture - 5 Geometrical Transformations

Uploaded by

frzerkebamo
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)
22 views57 pages

Lecture - 5 Geometrical Transformations

Uploaded by

frzerkebamo
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/ 57

WACHEMO UNIVERSITY

DURAME CAMPUS
COLLEGE OF ENGINEERING AND TECHNOLOGY
SCHOOL OF COMPUTING AND INFORMATICS
DEPARTMENT OF COMPUTER SCIENCE
LECTURE_5:- GEOMETRICAL TRANSFORMATIONS

Compiled by Selamu S.
Geometric Transformation-2D
 Transformation means changing some graphics into something else by applying rules.
 Transformation is changing of an objects after creation, in terms of position or size.
 We can have various types of transformations such as translation, scaling up or down, rotation,
reflection, shearing, etc.
 When a transformation takes place on a 2D plane, it is called 2D transformation.
 Transformations play an important role in computer graphics to reposition the graphics on the
screen and change their size or orientation.
 In many applications, changes in orientations, size, and shape are accomplished with geometric
transformations that alter the coordinate descriptions of objects.

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 2


Cont…,
♠ Given a point cloud, polygon, or sampled parametric curve, we can use transformations for
several purposes:
1) Change coordinate frames (world, window, viewport, device, etc).
2) Compose objects of simple parts with local scale/position/orientation of one part defined with
regard to other parts. For example, for articulated objects.
3) Use deformation to create new shapes.
4) Useful for animation.

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 3


2D Transformations
♠ Basic 2D transformations
Geometrical Transformations
♠ Matrix representation
♠ Linear Transformation
♠ Composite Transformation
♠ Euclidean Transformation
♠ Computational Efficiency
♠ Affine Transformation
♠ Homogeneous representation
♠ Projective Transformation
♠ Matrix composition

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 4


Linear Transformations
♠ Linear transformations are combinations of :-
 Scale,
 Rotation,  x'  a b   x 
 y '  c d   y 
 Shear, and     
 Mirror
♠ Properties:
 Satisfies: T ( s1p1  s2p 2 ) s1T (p1 )  s2T (p 2 )
 Origin maps to origin
 Lines map to lines
 Parallel lines remain parallel
11/09/2024
Ratios are preserved CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 5
Euclidean Transformations
♠ The Euclidean transformations are the most commonly used transformations.
♠ An Euclidean transformation is either a translation, a rotation, or a reflection.
♠ Properties:-
 Preserve length and angle measures

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 6


Affine Transformations
♠ Affine transformations are the generalizations of Euclidean transformation and combinations of
 Linear transformations, and  x'  a b c   x
 Translations  y '  d e f   y
 w  0 0 1   w
♠ Properties:   
 Origin does not necessarily map to origin
 Lines map to lines but circles become ellipses
 Parallel lines remain parallel
 Ratios are preserved
 Length and angle are not preserved

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 7


Projective Transformations
♠ Projective transformations are the most general linear transformations and require the use of
homogeneous coordinates.  x'   a b c   x
 y '   d e f   y
 w'  g h i   w
  
♠ Properties:
 Origin does not necessarily map to origin
 Lines map to lines
 Parallel lines do not necessarily remain parallel
 Ratios are not preserved
 Closed under composition
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 8
Transformation of Objects
♠ Basic types of transformations are:-
 Translation
 Rotation
 Scaling
♠ Application:
 Such as animation: to give life, virtual reality
 We use parameterised transformations that change over time t
 Thus for each frame the object moves a little further, just like a movie

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 9


2D Translation
♠ A translation moves an object to a different position on the screen.
♠ You can translate a point in 2D by adding translation coordinate (tx, ty) to the original
coordinate x, y to get the new coordinate x ′ , y ′ .
♠ It will shift the object from one position to other position.
♠ To translate a point from coordinate (x, y) to another (x′, y′) we add algebraically the translation
distances (tx, ty) to original coordinates.
♠ A translation of a single point is achieved by adding an offset to its coordinates, so as to
generate a new coordinate position.
♠ Translation refers to the shifting of a point to some other place, whose distance with regard to
the present point is known.
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 10
2D Translation (Cont…;)
♠ Translation operation: x'  x  t x
y'  y  t y
♠ Or, in matrix form:

𝐏 ′= 𝐏 + 𝐓
Example 1: Translate the triangle with the vertex of A(2,2), B(10,2) and C(5,5) and the
translating factor of the triangle is (5,6).
Ax′ = x + tx Ay ′ = x + ty Bx′ = x + tx By ′ = x + ty C x′ = x + tx C y ′ = x + ty
= 2+5 = 2+6 = 10 + 5 = 2+6 = 5+5 = 5+6
= 7 = 8 = 15 = 8 = 10 = 8
(7, 8) (15, 8) (10, 11)
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 11
2D Translation (Cont…;)
EXERCISE 1
1) Translate the square with the vertex of (0,0), (2,0), (0,2) (2,2) and the translating factor of
the square is (2,3).
2) Translate the rectangle (2,2), (2,8), (10,8), (10,2) with 2 units along x-axis and 3 units along
y-axis.
3) Suppose we want to shift a triangle with coordinates at A(20,10), B(30,100) and C(40,70).
The shifting to be done by 20 units along x-axis and 10 units along y-axis.
4) Translate a polygon with coordinates A (2, 5), B (7, 10) and C (10, 2) by 3 units in x-
direction and 4 units in y-direction.

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 12


2D Rotation (Cont…;)
♣ In rotation, we rotate the object at particular angle θ (theta) from its origin. From the following figure,
we can see that the point P(x, y) is located at angle ffrom the horizontal x coordinate with distance r
from the origin.
♣ Let us suppose you want to rotate it at the angle θ. After rotating it to a new location, you will get a new
point P’ (x’, y’).
♣ To rotate a polygon or other graphics primitive, we simply apply the (same) rotation transformation to
all of its vertices.

 Counter Clock Wise


x' = x cos() - y sin()  RHS
y' = x sin() + y cos()
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 13
2D Rotation (Cont…;)
Trig Identity…
x = r cos (f)
(x’, y’) y = r sin (f)
x’ = r cos(f) cos() – r sin(f) sin()
y’ = r sin(f) cos() + r cos(f) sin()
x’ = r cos (f + )
(x, y) y’ = r sin (f + ) Substitute…
x’ = x cos() - y sin()
y’ = x sin() + y cos()

f

♠ This is easy to capture in matrix form:


 x'  cos   sin    x 
x’ = x cos() - y sin()
y’ = x sin() + y cos()
=>  y '  sin   cos    y 
    
rotation matrix
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 14
2D Rotation (Cont…;)
Example 1: Translate the triangle with the vertex of (0,0), (1,0) and (1,1) and the rotating factor
of the triangle is 900. sin 90 0 = 1
Solution:
x' = x cos() - y sin() cos 900 = 0
y' = x sin() + y cos() Third Case: (1,1)
First Case: (0,0) x' = 0 cos 900 - 0 sin 900 y' = 0 sin 900 + 0 cos 900
x' = 0 cos 900 - 0 sin 900 y' = 0 sin 900 + 0 cos 900 = 1 (0)- 1 (1) = 1 (1)+ 1 (0)
= 0 (0)- 0 (1) = 0 (1)+ 0 (0) =0–1 =1+0
=0–0 =0+0 = -1 =1
=0 =0 (-1,1)
(0,0)
Second Case: (1,0)
x' = 0 cos 900 - 0 sin 900 y' = 0 sin 900 + 0 cos 900
= 1 (0)- 0 (1) = 1 (1)+ 0 (0)
=0–0 =1+0
=0 =1
(0,1)
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 15
2D Rotation (Cont…;)
EXERCISE 2
1) Rotate a triangle about the origin with vertices at original coordinates (10,20), (10,10),
(20,10) by 300 degrees
2) Rotate a triangle with vertices at original coordinates (10,20), (5,10), (20,10) by 45 0 degrees.
3) A matrix that rotates by π/4 radians in the clockwise direction
4) A matrix that rotates by π/4 radians in the counter clockwise direction

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 16


2D Scaling
♣Scaling is the concept of increasing (or decreasing) the size of a picture (in one or in either directions).

♣When it is done in both directions, the increase or decrease in both directions need not be same).

♣To change the size of the picture, we increase or decrease the distance between the end points of the

picture and also change the intermediate points are per requirements.
♣Scaling a coordinate means multiplying each of its components by a scalar
♣Uniform scaling:- means this scalar is the same for all components.
♣Non-uniform scaling:- different scalars per component.

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 17


2D Scaling (Cont…;)
♣ We scale a 2D object with respect to the origin by setting the scaling factors S x and Sy, which
are multiplied to the original vertex coordinate positions (x, y):
x ' s x x  x'  s x 0   x
♠ Or, in matrix form:      
♣ Scaling operation: y ' s y y  y '  0 sy   y
scaling matrix

♣ Note that scaling a point physically means shifting a point away. It does not magnify the point.
♣ But when a picture is scaled, each of the points is scaled differently and hence the dimension of
the picture changes.
♣ Scaling means to change the size of the picture.
♣ If (P) is the initial point and after scaling the point is (PO, then
𝐏 ′= 𝐒 ∗ 𝐏
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 18
2D Scaling (Cont…;)
Example 1: Consider a triangle formed by the points A (5,5), B(10,10) and C (10,5). Suppose we
scale it by a factor of 3 along x-axis and 2 along y-axis.
Soln: First Case: (5,5) Second Case: (10,10) Third Case: (5,5)
X' = Sx* X Y' = Sy* Y' X' = Sx* X Y' = Sy* Y' X' = Sx* X Y' = Sy* Y'
=5*3 =5*2 = 10 * 3 = 10 * 2 = 10 * 3 =5*2
= 15 = 10 = 30 = 20 = 30 = 10
(15, 10) (30, 20) (30, 10)
EXERCISE 3
1) Scale a triangle with respect to the origin, with vertices at original coordinates (10,20), (10,10),
(20,10) by sx=2, sy=1.5
2) Scale a triangle with vertices at original coordinates (10,25), (5,10), (20,10) by sx=1.5, sy=2,
with respect to the origin. Roughly plot the original and resultant triangles.
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 19
Matrix Representation
♠ Represent 2D transformation by a matrix
 a b
 c d 
♠ Multiply matrix by column vector
 apply transformation to point

 x '   a b   x  x' ax  by


 y '  c d   y  y ' cx  dy

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 20


Transformation in Matrix Representation
 x'  t x   x 
 y '  t    y  Translation
   y  

 x'  s x 0   x
 y '  0 
s y   y  Scaling
  

 x'  cos   sin    x 


 y '  sin   cos    y  Rotation
    
Can we make a composite matrix?
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 21
Homogeneous Coordinates
♠ We can express a translation in terms of a matrix multiplication operation by expanding the
transformation matrix from its representation by a 2x2 matrix to representation by a 3x3 matrix.
♠ This is accomplished by using homogeneous coordinates, in which 2D points (x, y) are
expressed as (xh, yh, h),
𝑿𝒉 𝒀𝒉
where h ≠ 0 and𝑿 = 𝒉 𝒀=
𝒉
Typically, we use h = 1.
♠ To perform a sequence of transformation such as translation followed by rotation and scaling,
we need to follow a sequential process
 Translate the coordinates,
 Rotate the translated coordinates, and then
 Scale the rotated coordinates
11/09/2024
to complete the composite transformation.
CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 22
Homogeneous Coordinates (Cont…;)
♣ Each point (x, y) is represented as (x, y, 1)
 Append a 1 at the end of vector!
♣ All transformations can be represented as matrix multiplication!
♣ Composite transformation becomes much easier!

Conventional Coordinate Homogeneous Coordinate

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 23


Homogeneous Coordinates (Cont…;)
♣ All transformations can be represented as matrix multiplication!
♣ Composite transformation becomes much easier!

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 24


2D Translation Matrix
♣ If the initial coordinate is (x, y, 1) and after the translation, the coordinate is {x', y', 1) and the
translation factor is and then we can represent this as follows below.
♣ Using homogeneous coordinates, we can express the equations that define a 2D translation of a
coordinate position:
 x'  t x   x  𝑥 ′ =𝑥+𝑡 𝑥
 y '  t    y  =>
   y   𝑦 ′ = 𝑦 +𝑡 𝑦
 x  1 0 t x   x  is called Translation Matrix
 y  0 1 t   y 
   y  =>
 1   0 0 1   1 
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 25
2D Rotation Matrix
♣ Homogeneous coordinate system, the Rotation is defined as follows:
♣ If the initial point is (X, Y, 1) and after the rotation, the point is (X', Y', 1) then we can define it
as follows :
 x  cos( )  sin( ) 0   x   cos    sin   0 
 y  sin( ) cos( ) 0   y  =>  
      R   sin   cos   0
 1   0 0 1   1   0 0 1 

is called Rotation Matrix

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 26


2D Scaling Matrix
♣ In Homogeneous coordinate system, the Scaling is defined as follows:
♣ If the initial point is (X, Y, 1) and after the Scaling the point is (X", Y', 1) then we can define it
as follows :

[][ ][ ]
𝑥′ 𝑠𝑥 0 0 𝑥 =>
𝑦′ = 0 𝑠𝑦 0 𝑦
1 0 0 1 1

is called Scaling Matrix

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 27


Transformation in Matrix Representation
 x  1 0 t x   x 
 y  0 1 t   y  Translation
   y 

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

 x  s x 0 0  x 
 y  0 sy 0  y 
   Scaling
 1   0 0 1  1 

 x  cos   sin   0  x 


 y  sin   cos  0  y  Rotation
    
 1   0 0 1  1 

Can we make a composite matrix now?


11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 28
Composite Transformation
♠ Matrices are a convenient and efficient way to represent a sequence of transformations.
♠ Transformations can be combined by multiplication, like
 x '   a b   e f i j  x
 y '  c d   g h   k l   y 
♠ 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.
♠ This is written as T = T1∙T2.
♠ Composite transformation can be achieved by concatenation of transformation matrices to
obtain a combined transformation matrix.
♠ A combined matrix:
11/09/2024
T  X   X T 1T 2T 3 ....Tn 
CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 29
Composite Transformation (Cont…;)
♣ Where [Ti] is any combination of Translation, Scaling, Shearing, Rotation, Reflection etc.
♣ 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.

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 30


Composite Transformation (Cont…;)
♠ Matrix Concatenation Properties
 Multiplication of matrices is associative
 The transformations appear in right-to-left order
 Same type of transformation can commute
 Rotation and uniform scaling can commute
 Rotations around different axes do not commute

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 31


Inverse Transformations
♣ For translation, the inverse is accomplished by translating in the opposite direction:
 1 0  tx 
T  1  0 1  t y 
 0 0 1 

Note that:- T-1(tx, ty) = T(-tx, -ty)

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 32


Inverse Transformations (Cont…;)
♣ For rotation, the inverse is accomplished by rotating about the negative of the angle:
 cos(   )  sin(   ) 0
1 
R  sin(   ) cos(   ) 0 
 0 0 1
 cos( ) sin( ) 0

  sin( ) cos( ) 0 
 0 0 1

Note that:- R-1() = RT() = R (-)

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 33


Inverse Transformations (Cont…;)
♣ For scaling, the inverse is accomplished by scaling by the reciprocal of the original amount in
each direction:
1 / s x 0 0
S  1  0 1 / s y 0
 0 0 1

Note that:- S-1(sx, sy) = S(1/sx, 1/sy)

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 34


Other 2D Transformations

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 35


Reflection
♠ Reflection is a transformation that produces a mirror image of an original object.
♠ In other words, we can say that it is a rotation operation with 180°.
♠ In reflection transformation, the size of the object does not change.

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 36


Reflection about X-axis
Basic Principles of Reflection Transformation
1.The image of an object is formed on the side opposite to where the object is lying, with respect
to the mirror line.
2.The perpendicular distance of the object (i.e., the object points) from the mirror line is identical
to the distance of the reflected image (i.e., the corresponding image points) from the same
mirror line. Once again, the two perpendiculars must be along the same straight line.
♣ Therefore the relation between the point P(x, y) and its image P’(x’, y’) about x-axis is simply,

x ' x
y '  y
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 37
Reflection about X-axis (Cont…;)
♣ So the transformation matrix for reflection about x-axis or y=0 axis is:
1 0 
Tm  y 0  
 0  1
♣ And the transformation matrix is represented as:

 x ' 1 0   x
 y '    
   0  1  y 

♣ Therefore;  x ' Tm  y 0  x 


11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 38
Reflection about Y-axis
♣ A reflection about y-axis flips x coordinates while y coordinates remains the same.
♣ For reflection of P(x, y) to P’(x’, y’)
x '  x
y ' y
♣ This transformation is identified by the reflection transformation matrix

  1 0
Tm  x0  
 0 1

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 39


Reflection about the Straight line y=x
♣ To find the relation between a point’s coordinates (x, y) and those of its image (x’, y’),
reflected through y=x straight line.
x ' y
y ' x
♣ This can be represented by:
 x '   0 1  x 
 y '   1 0   y 
    

♣ Where
 0 1
 1 0 is the transformation matrix Tm  y x
 
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 40
Reflection about the Straight line y= -x
♣ Considering the experimental point (x, y), we find that P and its image P’ both being the 4 th
quadrant, x, and x’ are (+ve) where as y, and y’ are (-ve).
♣ So considering this fact we should write,
x '  y
y '  x
♣ This can be represented by:

 x '   0  1  x 
 y '    1 0   y 
    
 0  1  Tm  y  x
Where is the transformation matrix
 1 0 

11/09/2024
 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 41
Shear
♣ A transformation that slants the shape of an object is called the shear transformation.
♣ It is similar to sliding the layers in one direction to change shape of the object.
♣ Shearing an object consists of linearly deforming it along either x-axis or y-axis or both.
♣ There are two shear transformations X-Shear and Y-Shear.
♣ One shifts x coordinates values and other shifts y coordinate values.
♣ However; in both the cases only one coordinate changes its coordinates and other preserves
its values.
♣ Shearing is also termed as Skewing.

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 42


X-Shear (Cont…;)
♣ There y coordinates remains the same and changes are made to x coordinates, which causes the
vertical lines to tilt right or left as shown in below figure.
♣ If P(x, y) to new point P’(x’, y’)
x '  x  shx * y
y ' y
♣ Transformation matrix

 x '   1 shx   x 
 y '   0 1   y 
    

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 43


Y-Shear (Cont…;)
♣ There x coordinates remains the same and changes the y coordinates which causes the
horizontal lines to transform into lines which slopes up or down as shown in the following
figure.
♣If P(x, y) to new point P’(x’, y’)
x ' x
y '  y  shy * x
♣Transformation matrix

 x '  1 0  x 
 y '  sh 
1   y 
   y
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 44
Shear (Cont…;)
Example 1: a triangle with A(2,2), B(0,0) and C(2,0). Apply shearing factor of 2 on x-axis and 2
on y-axis. Find out the new coordinates of the triangle.
x '  x  shx * y
Solution: X-Shear Coordinates
y ' y
A(2,2), B(0,0) C(2,0) shx=2 shy=2
X-shear A: x '  x  sh * y 2  2* 2 6
x X-shear C:
y '  y 2 x '  x  shx * y 2  2*0 2
(6, 2) y '  y 0
 X-shear B: (2, 0)
x '  x  shx * y 0  2*0 0
y '  y 0
(0, 0)
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 45
Shear (Cont…;)
Solution: Y-Shear Coordinates x ' x
A(2,2), B(0,0) C(2,0) shx=2 shy=2 y '  y  shy * x

 Y-shear A: x ' 2
y ' 2  2 * 2 6
(2, 6)

 Y-shear C: x ' 2
 Y-shear B: x ' 0 y ' 0  2 * 0 0
y ' 0  2 * 0 0 (2, 0)
(0, 0)

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 46


3D Transformations

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 47


3D Translations
♣ A translation is applied to an object by repositioning it, along a straight line path from one
coordinate location to another coordinate location.
♣ The translating factors tx, ty and tz along x, y, and z axis.
♣ In 3D homogeneous coordinate represents appoint is translated from P=(x, y, z) to position
P’=(x’,y’,z’) with the matrix operations.
 x  1 0 0 tx   x
 y  0 P' T .P
♣ P’=    1 0 t y   y
 
 z '  0 0 1 tz  z
     
 1  0 0 0 1  1

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 48


3D Translations (Cont…;)
Example:
1) A point has coordinate in the x, y, z direction i.e..; (5,6,7). The translation is done in the x
direction by 3, y direction by 3 and direction by 2, shift the object. Find out the coordinates of
the new position.
Solution: Given x=5, y=6, z=7 and

 x  1 0 0 tx   x 1 0 0 3  5  8
 y  0 1 0 t y   y 0   6  9
     1 0 3
  
 
 z '  0 0 1 tz  z 0 0 1 2  7  9
           
 1  0 0 0 1  1 0 0 0 1  1  1
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 49
3D Scaling
♣ Scaling in 3D is also an extension of scaling in 2D.
♣ Scaing is the transformation which will change the object size, based on the scaling factors s x,

sy and sz along x-axis, y-axis, and z-axis.


 x  sx 0 0 0  x
 y  0 sy 0 
0  y
    
 z '  0 0 sz 0 z
     
 1  0 0 0 1  1

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 50


3D Rotation
♣ Rotating an object with respect to an angle.
 Let the initial coordinates of P(x, y, z)
 initial angle= f
 Rotation angle = θ
 The new coordinates (x’, y’, z’)
♣ There are three possible types of rotation
 X-axis
 Y-axis
 Z-axis

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 51


Rotation about x-axis
x ' x
y '  y cos   z sin 
z '  y sin   z cos 

 x  1 0 0 0  x
 y  0 cos   sin  
0  y
    
 z '  0 sin  cos  0 z
     
 1  0 0 0 1  1

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 52


Rotation about y-axis
x '  z sin   x cos 
y ' y
z '  z cos   x sin 
 x  cos  0 sin  0  x
 y  0 1 0 0   y
    
 z '    sin  0 cos  0 z
     
 1  0 0 0 1  1

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 53


Rotation about z-axis
x '  x cos   y sin 
y '  x sin   y cos 
z ' z
 x  cos   sin  0 0  x
 y  sin  cos  0 0   y
    
 z '  0 0 1 0 z
     
 1  0 0 0 1  1

11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 54


3D Rotation (Cont…;)
Example:
1) A point has coordinate in the x, y, z direction i.e..; (1,2,3). Rotation angle is 900. find out the
rotated new coordinates. sin 90 0 = 1
Solution: cos 900 = 0
x ' 1
x ' 1cos 90  2sin 90 1*0  2*1  2
y ' 2 cos 90  3sin 90 2 * 0  3*1  3
y ' 1sin 90  2 cos 90 1*1  2*0 1
z ' 2 sin 90  3cos 90 2 *1  3* 0 2
z ' 3
(1,  3, 2)
( 2,1,3)
x ' 3sin 90  1cos 90 3*1  1* 0 3
y ' 2
z ' 3 cos 90  1sin 90 3* 0  1*1  1
(3, 2,  1)
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 55
READING ASSIGNMENT
1) 3D REFLECTION
2) 3D SHEARING
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 56
! ! !
Yo u
a n k
T h
11/09/2024 CHAPTER 5: GEOMETRICAL TRANSFORMATIONS 57

You might also like