Unit II Transformations
Unit II Transformations
Transformation Types
• Translation
• Rotation
• Scaling
• Reflection
• Shearing
Translation -2D
X
P’(x’,y’)
ty
P(x,y)
tx
Translation – 2D
• P’ = f(P)
• x’ = x+tx;
• y’ = y+ty;
r
Y=r.Sin(α)
α
X=r.Cos(α)
Rotation
• Initial Position
X = r.Cos(α)
Y = r.Sin(α)
• Final Position
X’ = r.Cos(α+θ)
Y’ = r.Sin(α+θ)
• We can write
X’= r.Cos(α)Cos(θ) - r.Sin(α)Sin(θ)
Y’= r.Cos(α)Sin(θ) + r.Sin(α)Cos(θ)
X’ Cos(θ) – Sin(θ) X
=
Y’ Sin(θ) Cos(θ) Y
Scaling
X’ Sx 0 X
Y’ = 0 Sy Y
If Sx = Sy Uniform Scaling
If Sx ≠ Sy Differential Scaling
Scaling Factor >1 Enlarges the Size of Object.
Scaling Factor <1 Reduces the Size of Object
Shear
X’ 1 Shx X
Y’
= 0 1 Y
• Y-Direction Shear
X’ = X
Y’ = X*Shy + Y
X’ = 1 0 X
Y’ Shy 1 Y
Reflection
-1 0 Y-Axis
0 1
(-X, Y) (X, Y)
X-Axis
-1 0 1 0
0 -1
0 -1
Reflection
Y-Axis
0 -1 0 1
-1 0 1 0
Y = -X Y=X
(Y, X)
(-Y, -X)
(X, Y) (X, Y)
X-Axis
Homogeneous Coordinates
• Transformations like Scaling, Reflection, Rotation and
Shear are accomplished by Matrix multiplication.
• Rotation
X’ Cos(θ) -Sin(θ) 0 X
Y’ = Sin(θ) Cos(θ) 0 Y
1 0 0 1 1
Homogeneous Coordinates
• Scaling
X’ Sx 0 0 X
Y’ = 0 Sy 0 Y
1 0 0 1 1
• Shear in X-Direction
X’ 1 Shx 0 X
Y’ = 0 1 0 Y
1 0 0 1 1
Homogeneous Coordinates
• Shear in Y-Direction
X’ 1 0 0 X
Y’ = Shy 1 0 Y
1 0 0 1 1
• Inverse Scaling
X’ 1/Sx 0 0 X
Y’ = 0 1/Sy 0 Y
1 0 0 1 1
Those are:
However, the user will have flexibility of inputting the data in other
coordinate systems as well such as polar or spherical coordinate system.
• Model coordinate system is the only coordinate system that the modeling
software recognizes when storing or retrieving the graphical information in or
from model database.
• Rotational Mapping
• General Mapping
Translational Mapping
Y
1 0 tx
0 1 ty
0 0 1
ty
Y’
tx
X’
If The axes of the two coordinate systems(original and new) are parallel, then the
mapping is translational mapping.
Rotational Mapping
If the two coordinate system ( original and new ) have common origin but the axes are at
an angle, then the mapping is rotational mapping.
Cos(α) -Sin(α) 0
Y Y’ P
Sin(α) Cos(α) 0
X
0 0 1
Y
Y*Cos(α)
X
Y α
X
X*Sin(α)
α
Y*Sin(α)
X’
X*Cos(α)
General Mapping
It is the combination of rotational and translational mapping.
Y
X
Y’
α
tx
ty
Cos(α) -Sin(α) tx
Sin(α) Cos(α) ty
X’
0 0 1
ORTHOGRAPHIC PROJECTION
The simplest of the Parallel projections is the orthographic projection, commonly used for
engineering drawings. They accurately show the correct or true size and shape of single plane face
of an object. orthographic projections are projections onto one of the coordinate planes x=0, y=0,
z=0.The matrix for projection onto the z plane is
Notice that the third column (the z column) is all zeros. Consequently, the effect of the
transformation is to set the z coordinate of a position vector to zero.
Similarly, the matrices for projection on to x=0 and y=0 planes are