Geometric Transformations

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

ME F318 Computer Aided Design

Geometric Transformations

BITS Pilani Dr. Amit R. Singh


Pilani Campus

1 / 23
What is a Geometric Transformation?

• A one-to-one mapping of elements from a set.


• Usually, it maps a set to itself.
• The inverse mapping must exist.

2 / 23 BITS Pilani, Pilani Campus


Classification of Geometric
Transformations

• Based on dimensions of the set.


• Based on some “special property” of the Transformation.

3 / 23 BITS Pilani, Pilani Campus


Classification based on “special property”

• Isometric Transformations: preserve angles and distances.


• Similarity Transformations: preserve angles and ratios of
distances.
• Affine Transformations: preserve parallelism.
• Projective Transformations: preserve collinearity.

4 / 23 BITS Pilani, Pilani Campus


Homogeneous Coordinates

Definition
If (x, y ) are the Euclidean coordinates of a point P, in R2 , and if
(x1 , x2 , x3 ) are any three real numbers such that x1 /x3 = x and
x2 /x3 = y , then the triple (x1 , x2 , x3 ) is said to be a set of
homogeneous coordinates for P.

5 / 23 BITS Pilani, Pilani Campus


Why Homogeneous Coordinates?

• One motivation: to define intersection of parallel lines.


• It “homogenizes” equations:
→ l1 x + l2 y + l3 = 0 becomes l1 x1 + l2 x2 + l3 x3 = 0.
→ a11 x 2 + 2a12 xy + a22 y 2 + 2a13 x + 2a23 y + a33 = 0.
becomes
a11 x12 + 2a12 x1 x2 + a22 x22 + 2a13 x1 x3 + 2a23 x2 x3 + a33 x32 = 0.
• It helps us write translations as a matrix multiplication.

6 / 23 BITS Pilani, Pilani Campus


Isometric Transformations

Definition
The general form of an 2D isometric transformation is
 ′   
x ϵ cos θ − sin θ tx x
y ′  =  ϵ sin θ cos θ ty  y 
1 0 0 1 1

where ϵ is either 1 or -1.

7 / 23 BITS Pilani, Pilani Campus


Properties of Isometric Transformations

• When ϵ = 1, orientation is preserved and the transformation is


a rigid body motion. Also called as Euclidean Transformations.
• When ϵ = −1, orientation is reversed and the transformation
is a reflection composed with a rigid body motion.
• This transformation preserves lengths, angles and areas. “Iso”
= same and “Metry” = distance.

8 / 23 BITS Pilani, Pilani Campus


Similarity Transformations

Definition
The general form of a similarity transformation is
 ′   
x s cos θ −s sin θ tx x
y ′  =  s sin θ s cos θ ty  y 
1 0 0 1 1

The upper left 2 × 2 matrix is a rotation matrix R multiplied by a


scalar s.

9 / 23 BITS Pilani, Pilani Campus


Properties of Similarity Transformations

• It preserves shape but not necessarily the size.


Mathematically, it preserves ratio of lengths and areas.
• The parameter s provides isotropic scaling.

10 / 23 BITS Pilani, Pilani Campus


Affine Transformations

Definition
The general form of an affine transformation or an affinity is
 ′   
x a11 a12 tx x
y ′  = a21 a22 ty  y 
1 0 0 1 1

The upper left 2 × 2 matrix is denoted as A, the affine matrix.

11 / 23 BITS Pilani, Pilani Campus


Properties of Affine Transformations

• The matrix A can be decomposed into two rotations and a


scaling in the following sequence

A = R(θ)R(−ϕ)DR(ϕ)
 
λ 0
where the R denote rotations and D = 1 is a scaling
0 λ2
matrix. This scaling happens along x and y directions which
are rotated by an angle −ϕ with respect to the original x − y -
axes.
• An affinity has 6 degrees of freedom. Hence it requires, 3
points in correspondence to uniquely determine it.

12 / 23 BITS Pilani, Pilani Campus


Properties of Affine Transformations
(contd.)

• In addition to the changes possible by similarity, affinity allows


for shearing i.e. non-isotropic scaling.
• Affinity preserves parallel lines.
• If |A| < 0, orientation is reversed. It can therefore be used for
reflection.

13 / 23 BITS Pilani, Pilani Campus


Projective Transformations

Definition
The general form of a projective transformation or a projectivity is
 ′   
x a11 a12 tx x
y ′  = a21 a22 ty  y 
1 v1 v2 v 1

Note
The element v in the transformation matrix is generally used to
scale all the other elements. So it is generally equal to 1. But in
some situations, its value needs to be set to 0. Therefore, we say
that the matrix has only 8 degrees of freedom.

14 / 23 BITS Pilani, Pilani Campus


Properties of Projective Transformations

• A projectivity has 8 degrees of freedom since it is a


homogeneous matrix. It requires correspondence between 4
non-collinear points before and after the transformation to
determine the projectivity.
• Collinearity is preserved.

15 / 23 BITS Pilani, Pilani Campus


Properties of Projective Transformations
(contd.)

A projective transformation can transform parallel lines into


intersecting lines by shifting points at infinity to finite positions.
Example
Consider a point at infinity (x1 , x2 , 0)T . Under affine
transformation we get,
    
 x1   x 
A 1

A t
x = x2
0T 1  2  
0 0

which is still a point at infinity.

16 / 23 BITS Pilani, Pilani Campus


Example (contd.)

But under projective transformation


     
 x1   x
A 1

A t

x = x
v T v  2  2
0 v1 x1 + v2 x2

we get a finite point if both v1 and v2 are not simultaneously 0.


Thus, projective transformations can map vanishing points.

17 / 23 BITS Pilani, Pilani Campus


Vanishing Point

Courtesy: Jakec - Own work, CC BY-SA 4.0, via Wikimedia Commons

18 / 23 BITS Pilani, Pilani Campus


Vanishing Point

Courtesy: Mgunyho, original drawing by NiharikaMaheshwari, CC BY-SA 4.0, via


Wikimedia Commons
19 / 23 BITS Pilani, Pilani Campus
Combined Transformations

Transforming a point P, represented by a column vector, by


transformation matrices T1 , T2 , . . . , Tn sequentially is the same as
transforming the point by a combined transformation matrix

T = Tn Tn−1 . . . T1 .

If P is represented by a row vector, then the combined


transformation matrix is

T = T1 T2 . . . Tn .

because P is pre-multiplied to a transformation matrix in this case.

20 / 23 BITS Pilani, Pilani Campus


Fixed Points

Definition
A fixed point of a transformation remains unchanged under the
action of the transformation.

21 / 23 BITS Pilani, Pilani Campus


Demonstrations

You can check out the interactive plots in the following notebooks
• DemoIsometry.ipynb
• DemoSimilarity.ipynb
• DemoAffinity.ipynb

22 / 23 BITS Pilani, Pilani Campus


Demonstrations (contd.)

1. A Geogebra based demonstration of a Projective Transformation has been made


available.
2. It demonstrates “Elation” which is a 2D geometric transformation represented
by the following matrix in homogeneous coordinates
 
1 0 0
0 1 0
v1 v2 v

3. In the demo, the original points and lines are shown in gray. Under the action of
the elation matrix, the points are projected to the red points that lie in a 3D
plane whose equation is z = v1 x + v2 y + v .
4. The final result of the projective transformation, shown in blue, are obtained by
modifying the homogeneous coordinates of the red-points such that their third
coordinate is 1. This is equivalent to projecting them to z = 1 plane. If we join
the blue points with their red counterparts, we will get lines which converge at
the origin i.e. origin is the point of projection.

23 / 23 BITS Pilani, Pilani Campus

You might also like