100% found this document useful (1 vote)
133 views41 pages

Geometric Transformation

Geometric transformations include translation, rotation, scaling, and reflection. They are important in computer graphics as they allow manipulation of an object's shape, size, and position. There are two main types of transformations: geometric transformations which alter an object's coordinates, and viewing transformations which change the coordinate system without altering the object. Key geometric transformations in 2D include translation by adding offsets to x and y coordinates, rotation about an origin by changing angles, and scaling by multiplying x and y values. Representing transformations using homogeneous coordinates in 3D matrices allows various transformations to be combined through matrix multiplication.

Uploaded by

dejenem398
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
133 views41 pages

Geometric Transformation

Geometric transformations include translation, rotation, scaling, and reflection. They are important in computer graphics as they allow manipulation of an object's shape, size, and position. There are two main types of transformations: geometric transformations which alter an object's coordinates, and viewing transformations which change the coordinate system without altering the object. Key geometric transformations in 2D include translation by adding offsets to x and y coordinates, rotation about an origin by changing angles, and scaling by multiplying x and y values. Representing transformations using homogeneous coordinates in 3D matrices allows various transformations to be combined through matrix multiplication.

Uploaded by

dejenem398
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Geometric

Transformation (2D & 3D)


1. Geometric Transformations:
 What is transformation?

> It is the backbone of computer graphics, enabling us to manipulate the

shape, size, and location of the object.

> Changing something to something else via rules.

 Why are they important to graphics?

> It can be used to effect the following changes in a geometric object:

1. Change the location

2. Change the shape

3. Change the size

4. Rotate and

5. Copy.
2. Types of Transformations

1. Geometric/Modeling Transformation/ Object Transformation

> This transformation alters the coordinate values of the object. Basic operations are

scaling, translation, rotation and combination of one or more of these basic

transformations.

> Object transformation = Move (transform) an object in the 2D/3D space.

2.Visual/ Viewing Transformation (Coordinate System Transformation)

> In this transformation there is no change in either the geometry or the coordinates

of the object. A copy of the object is placed at the desired sight, without changing

the coordinate values of the object.

> Coordinate system transformation = Move (transform) the coordinate system.

View the objects from the new coordinate system.


3. Types Geometric of Transformations

 Translation

 Rotation

 Scaling

 Reflection/Mirroring.

4
i. Translation - 2D

Moving an object is called a translation.

We translate a point by adding to the x and y coordinates, respectively,

the amount the point should be shifted in the x and y directions.

We translate an object by translating each vertex in the object.

𝑿𝒏𝒆𝒘 = 𝑿𝒐𝒍𝒅 + 𝒕𝒙; 𝒀𝒏𝒆𝒘 = 𝒀𝒐𝒍𝒅 + 𝒕𝒚


Cont’d…
Y Y

(4,5) (7,5)

(7,1) (10,1)
Before Translation X Translation by (3,-4) X

x’ = x + dx
y’ = y + dy
 x  x dx 
P  P    T    P  P  T
 y  y  d y 
Homogeniou s Form
 x 1 0 d x   x
 y  0 1 d  *  y
   y  

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


ii. Scaling

> Changing the size of an object is called a scale. We scale an object by

scaling the x and y coordinates of each vertex in the object.

𝐖𝐧𝐞𝐰
𝐬𝐱 =
𝐖𝐨𝐥𝐝

𝐡𝐧𝐞𝐰
𝐬𝐲 =
𝐡𝐨𝐥𝐝

𝐗𝐧𝐞𝐰 = 𝐬𝐱𝐗𝐨𝐥𝐝

𝐘𝐧𝐞𝐰 = 𝐬𝐲𝐘𝐨𝐥𝐝
Cont’d…
Y Y

Types of Scaling:
(4,5) (7,5)

(2,5/4) (7/2,5/4)  Differential ( sx != sy )


Before Scaling X Scaling by (1/2, 1/4) X  Uniform ( sx = sy )

x  s x * x
y  s y * y
S * P  P Homogeniou s Form
    x sx 0 0  x
 y   0 0 *  y
s x 0   x  x * s x     sx
*   
0
 s y   y  y * s y  1  0 0 1 1
iii. Rotation about the origin (2D)
ø Consider rotation about the origin by Θ degrees

ø Radius stays the same, angle increases by Θ.

r cos 
v   r sin  
 
r cos  
v 
 r sin  
 

 x  r cos cos  r sin sin


expand     
 y  r cos sin  r sin cos
x  r cos x  x cos  y sin
but 
y  r sin y  x sin  y cos
Cont’d
Y Y
Before Rotation Rotation of 45 deg. w.r.t. origin

(4.9,7.8)

(2.1,4.9)

(5,2) (9,2)
X X

x*cos  y*sin  x
x*sin  y*cos  y

Homogenious Form
R * P P
 x cos  sin 0  x
cos sin  x x *cos  y*sin   y  sin cos 0 *  y
* 
sin cos  y x *sin  y*cos    
1   0
  
      0 110 1
Cont’d
Cont’d…
Example:

• Translate a triangle with vertices at original

coordinates (10,20), (10,10), (20,10) by tx=5, ty=10.


Example:

 If the triangle A(1, 1), B(2, 1), C(1, 3) is scaled by a factor

2, find the new coordinates of the triangle.


Substituting for r, gives:
𝒙 ′ = 𝒙𝒄𝒐𝒔𝜽 − 𝒚𝒔𝒊𝒏𝜽
𝒚 ′ = 𝒙𝒔𝒊𝒏𝜽 + 𝒚𝒄𝒐𝒔𝜽
Cont’d…
Cont’d…
Example:

• Rotate the rectangle (0, 0), (2, 0), (2, 2), (0, 2) by 30occw

about its centroid and find the new coordinates of the

rectangle.
Summary
3. Homogeneous Coordinates
> In order to represent a translation as a matrix multiplication operation

we use 3 x 3 matrices and pad the points to become 3 x 1 matrices.

> This coordinate system (using three values to represent a 2D point) is

called homogeneous coordinates.

> Let the added extra coordinate be W, to a point: P (x, y, W).

> Two sets of homogeneous coordinates represent the same point if they

are a multiple of each other.

> If W ≠ 0 , divide by it to get Cartesian coordinates of point: (x/W, y/W, 1).

> If W = 0, point is said to be at infinity.


Cont’d…

Transformation matrices for 2D translation are now 3x3.


Concatenation of transformation
Cont’d…
Properties of translations
Homogeneous form of scale

Concatenation of scales
Ex.1: Rotation of object about arbitrary point P (x, y) by θ

> Translate point (x, y) to origin by

(-x, -y)

> Rotate by θ

> Translate the point by (x, y)


Reflections/Mirroring
More Reflections
3 D - Rigid body transformations

🖝 Methods for object modeling transformation in three dimensions are

extended from two dimensional methods by including consideration

for the z coordinate.

🖝 Preserve lines, angles and distances.


Cont’d…

3D transformation:

» Generalize from 2D by including z coordinate

» Straight forward for translation and scale

» Rotation more difficult

» Homogeneous coordinates: 4 components

» Transformation matrices: 4×4 éléments.


3D Point:
🖝 We will consider points as column vectors.

🖝 Thus, a typical point with coordinates (x, y, z) is represented as:

3D Point Homogenous Coordinate:


🖝 A 3D point P is represented in homogeneous coordinates by a 4-

dim, Vector.

🖝 We don't lose anything.

🖝 The main advantage: it is easier to compose translation and

rotation.

🖝 Everything is matrix multiplication.


i. 3D Translation
» In homogeneous coordinates, 3D transformations are represented by 4×4

matrixes:.

» An object is translated in 3D dimensional by transforming each of the defining

points of the objects .

» P is translated to P' by:


Cont’d…
# An object represented as a set of polygon surfaces, is translated by

translate each vertex of each surface and redraw the polygon facets in the

new position.
ii. 3D Rotation
🖝 In general, rotations are specified by a rotation axis and an angle.

🖝 In two-dimensions there is only one choice of a rotation axis that leaves points in

the plane.

🖝 The easiest rotation axes are those that parallel to the coordinate axis.

🖝 Positive rotation angles produce counterclockwise rotations about a coordinate

axis, if we are looking along the positive half of the axis toward the coordinate

origin.
Rotation about Z-axis: Rotation about X-axis:
: For z axis same as 2D rotation:

P′ = Rz(θ) ⋅P P′ = Rx(θ) ⋅P
Cont’d…

• Rotation about y-axis


General 3D Rotations about axis // to coordinate axis

🖝 Rotation axis parallel with coordinate axis (Example x axis):

𝐏 ′ = 𝐓−𝟏. 𝐑𝐱 𝛉 . 𝐓. 𝐏
iii. 3D Scaling

# About origin: Changes the size of the object and

repositions the object relative to the coordinate original.

P′ = S ⋅ P
• Scale about any arbitrary point:
iV. 3D Reflections:

🖝 About an axis: equivalent to 180°rotation about that axis.

🖝 About a plane: A reflection through the xy plane.

🖝 A reflections through the xz and the yz planes are defined

similarly.
Cont’d…
Thank you

You might also like