KEMBAR78
CG Unit 3 Notes | PDF | Cartesian Coordinate System | Mathematics
0% found this document useful (0 votes)
63 views30 pages

CG Unit 3 Notes

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
0% found this document useful (0 votes)
63 views30 pages

CG Unit 3 Notes

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/ 30

1|Page

Unit – III
2D, 3D Transformations and Projections
1. 2–D transformations

1.1 Introduction

Transformation means changing some graphics into something else by applying rules. We can
have various types of transformations such as translation, scaling up or down, rotation,
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.

1.2 Homogeneous Coordinates

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.

 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.

In this way, we can represent the point by 3 numbers instead of 2 numbers, which 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’(Xh, Yh, h).

1.3 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′.
2|Page

From the above figure, you can write that −

X’ = X + tx

Y’ = Y + ty

The pair (tx, ty) is called the translation vector or shift vector. The above equations can also be
represented using the column vectors.

[ ] [ ] [ ]
P= P’ = T=
[ ] [ ] [ ]

We can write it as −

P’ = P + T

The translation matrix moves a point by tx units in the x–direction and ty units in the y–
direction. This transformation is represented as:

1 0 0
T= 0 1 0
𝑡 𝑡 1

1.4 Scaling

To change the size of an object, scaling transformation is used. In the scaling process, you
either expand or compress the dimensions of the object. Scaling can be achieved by multiplying
the original coordinates of the object with the scaling factor to get the desired result.

Let us assume that the original coordinates are X, Y, the scaling factors are (Sx, Sy), and the
produced coordinates are X′,Y′. This can be mathematically represented as shown below −

X' = x ⋅ Sx and Y' = y ⋅ Sy


3|Page

The scaling factor SX, SY scales the object in X and Y direction respectively. The above equations
can also be represented in matrix form as below −

OR

P’ = P ⋅ S

Where S is the scaling matrix. The scaling process is shown in the following figures.

If we provide values less than 1 to the scaling factor S, then we can reduce the size of the object.
If we provide values greater than 1, then we can increase the size of the object.

The scaling matrix, where Sx is the scaling factor along the x–axis and Sy is the scaling factor
along the y–axis, is:

𝑆 0
S= 0 𝑆

1.5 Reflection

Reflection is the mirror image of 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.

The following figures show reflections with respect to x and y axes, and about the origin
respectively.
4|Page

a) The reflection matrix about the x–axis is:

1 0 0
Rx = 0 –1 0
0 0 1

b) The reflection matrix about the y–axis is:

–1 0 0
Ry = 0 1 0
0 0 1

c) The reflection matrix about the origin is:

–1 0 0
Ro = 0 –1 0
0 0 1

d) The reflection matrix about the line y = mx is:

0 1 0
Rl = 1 0 0
0 0 1

1.6 Shear
5|Page

A transformation that slants the shape of an object is called the shear transformation. 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.

X–Shear

The X–Shear preserves the y coordinate and changes are made to x coordinates, which causes
the vertical lines to tilt right or left as shown in below figure.

1 𝑠ℎ 0
Xsh = 0 1 0
0 0 1

X’ = X + shx ⋅ Y

Y’ = Y

Y–Shear

The Y–Shear preserves the x coordinates 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.
6|Page

The Y–Shear can be represented in matrix from as −

1 0 0
Ysh = 𝑠ℎ 1 0
0 0 1

Y' = Y + shy ⋅ X

X’ = X

1.7 Rotation

In rotation, we rotate the object at particular angle θ from its origin. From the following figure,
we can see that the point P (X,Y) is located at angle φ from 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′).

Using standard trigonometric the original coordinate of point P (X,Y) can be represented as −

X = r cosϕ …(1)

Y = r sinϕ …(2)

Same way we can represent the point P’(X′,Y′) as −

X′ = r cos(ϕ+θ) = rcosϕcosθ − rsinϕsinθ ...(3)

Y′= r sin(ϕ+θ) = rcosϕsinθ + rsinϕcosθ ...(4)

Substituting equation 1 & 2 in 3 & 4 respectively, we will get


7|Page

X′ = xcosθ − ysinθx′ = xcosθ − ysinθ

Y′ = xsinθ + ycosθy′ = xsinθ + ycosθ

Representing the above equation in matrix form,

or P’ = P ⋅ R

Where R is the rotation matrix

The rotation angle can be positive and negative.

For positive rotation angle (clockwise direction), we can use the above rotation matrix.
However, for negative angle rotation (anticlockwise direction), the matrix will change as shown
below:

1.8 Rotation about an arbitrary point

If we want to rotate an object or point about an arbitrary point, first of all, we translate the point
about which we want to rotate to the origin. Then rotate point or object about the origin, and at
the end, we again translate it to the original place. We get rotation about an arbitrary point.

Example: The point (x, y) is to be rotated

The (xc yc) is a point about which counterclockwise rotation is done

Step 1: Translate point (xc yc) to origin


8|Page

Step 2: Rotation of (x, y) about the origin

Step 3: Translation of center of rotation back to its original position.

2. 3–D transformations

2.1 Introduction

In very general terms a 3D model is a mathematical representation of a physical entity that


occupies space. In more practical terms, a 3D model is made of a description of its shape and
a description of its color appearance. 3–D Transformation is the process of manipulating the
view of a 3D object with respect to its original position by modifying its physical attributes
through various methods of transformation like Translation, Scaling, Rotation, Shear, etc.

Properties of 3–D Transformation:

 Lines are preserved,

 Parallelism is preserved,

 Proportional distances are preserved.

2.2 Translation

It is the movement of an object from one position to another position. Translation is done using
translation vectors. There are three vectors in 3D instead of two. These vectors are in X, Y, and
9|Page

Z directions. Translation in the x–direction is represented using Tx. The translation is y–


direction is represented using Ty. The translation in the z–direction is represented using Tz.

If P, a point having co–ordinates in three directions P(X, Y, Z) is translated, then after translation
its coordinates will be P’(X’, Y’, Z’) after translation. Tx Ty Tz are translation vectors in x, y, and
z directions respectively.

X’= X + Tx
Y’= Y + Ty
Z’= Z + Tz

Three–dimensional transformations are performed by transforming each vertex of the object.


If an object has five corners, then the translation will be accomplished by translating all five
points to new locations. Following figure 1 shows the translation of point figure 2 shows the
translation of the cube.

Matrix for Transla on:

1 0 0 0
0 1 0 0
T[X, Y, Z] = 0 0 1 0
𝑇 𝑇 𝑇 1

Matrix representa on of point transla on

Point shown in fig is (X, Y, Z). It becomes (X’, Y’, Z’) after translation. Tx Ty Tz are translation
vectors.

P’ [X’, Y’, Z’, 1] = P [X, Y, Z, 1] ⋅ T [X, Y, Z]


10 | P a g e

1 0 0 0
0 1 0 0
[X’ Y’ Z’ 1] = [X Y Z 1] 0 0 1 0
𝑇 𝑇 𝑇 1

2.3 Scaling

You can change the size of an object using scaling transformation. In the scaling process, you
either expand or compress the dimensions of the object. Scaling can be achieved by multiplying
the original coordinates of the object with the scaling factor to get the desired result.

The following figure shows the effect of 3D scaling –

In 3D scaling operation, three coordinates are used. Let us assume that the original coordinates
are X, Y, Z, scaling factors are (Sx, Sy, Sz) respectively, and the produced coordinates are X′, Y′,
Z′. This can be mathematically represented as shown below −

P’ = P ⋅ S
11 | P a g e

2.4 Reflection

Reflection in 3D space is quite similar to the reflection in 2D space, but there is a single
difference in 3D and that is we have to deal with three axes (x, y, z). Reflection is nothing but
a mirror image of an object.

Three kinds of Reflections are possible in 3D space:

 Reflection along the X–Y plane.

 Reflection along Y–Z plane.

 Reflection along X–Z plane.

1. Reflection relative to XY plane

2. Reflection relative to YZ plane

3. Reflection relative to ZX plane


12 | P a g e

2.5 Shear

A transformation that slants the shape of an object is called the shear transformation. Like in
2D shear, we can shear an object along the X–axis, Y–axis, or Z–axis in 3D.

As shown in the above figure, there is a coordinate P. You can shear it to get a new coordinate
P', which can be represented in 3D matrix form as below −

P’ = P · Sh

2.6 Rotation

Rotation is moving of an object about an angle. Movement can be anticlockwise or clockwise.


3D rotation is complex as compared to the 2D rotation. For 2D we describe the angle of
rotation, but for 3D, angle of rotation and axis of rotation are required. The axis can be either
x or y or z.
13 | P a g e

Derivation of 3D transformation matrix for rotation about a principal axis:

To derive the 3D transformation matrices for rotation about the principal axes (x, y, and z
axes), we will use the right-hand rule convention. The general approach involves rotating a
point in 3D space by an angle θ around one of the coordinate axes.

Coordinates before rotation:

1. Rotation about the x-axis:

When rotating around the x-axis, the y and z coordinates are transformed, while the x coordinate
remains unchanged.

Rotation matrix for x-axis:


14 | P a g e

Explanation:

 The x-coordinate is unchanged.

 The transformation affects the y and z coordinates:

o New y coordinate: y′ = ycos(θ) + zsin(θ)

o New z coordinate: z′ = −ysin(θ) + zcos(θ)

2. Rotation about the y-axis:

When rotating around the y-axis, the x and z coordinates are transformed, while the y coordinate
remains unchanged.

Rotation matrix for y-axis:

Explanation:

 The y-coordinate is unchanged.

 The transformation affects the x and z coordinates:

o New x coordinate: x′ = xcos(θ) − zsin(θ)

o New z coordinate: z′ = xsin(θ) + zcos(θ)

3. Rotation about the z-axis:

When rotating around the z-axis, the x and y coordinates are transformed, while the z coordinate
remains unchanged.

Rotation matrix for z-axis:

Explanation:

 The z-coordinate is unchanged.


15 | P a g e

 The transformation affects the x and y coordinates:

o New x coordinate: x′=xcos(θ)+ysin(θ)

o New y coordinate: y′=−xsin(θ)+ycos(θ)

2.7 Rotation about an arbitrary axis

When the object is rotated about an axis that is not parallel to any one of co-ordinate axis, i.e.,
x, y, z. Then additional transformations are required. First of all, alignment is needed, and then
the object is being back to the original position. Following steps are required

Step 1: Initial position of P' and P" is shown

Step 2: Translate object P' to origin

Step 3: Rotate P" to z axis so that it aligns along the z-axis


16 | P a g e

Step 4: Rotate about around z- axis

Step 5: Rotate axis to the original position

Step 6: Translate axis to the original position.

3. Projections
Projection is a kind of phenomena that is used in computer graphics to map the view of a 3D
object onto the projecting display panel where the viewing volume is specified by the world
coordinate and then map these world coordinate over the view port.
17 | P a g e

3.1 Parallel Projection

Parallel projection is a kind of projection where the projecting lines emerge parallelly from the
polygon surface and then incident parallelly on the plane. In parallel projection, the centre of
the projection lies at infinity. In parallel projection, the view of the object obtained at the plane
is less-realistic as there is no for-shortcoming and the relative dimension of the object remains
preserves.

3.1.1 Orthographic Projec on

It is a kind of parallel projection where the projecting lines emerge parallelly from the object
surface and incident perpendicularly at the projecting plane.

Orthographic Projection is of two categories:

1. Multiview Projection: It is further divided into three categories


18 | P a g e

a. Top-View: In this projection, the rays that emerge from the top of the polygon surface are
observed.

b. Side-View: It is another type of projection orthographic projection where the side view of
the polygon surface is observed.

c. Front-View: In this orthographic projection front face view of the object is observed.

2. Axonometric Projection: Axonometric projection is an orthographic projection, where the


projection lines are perpendicular to the plane of projection, and the object is rotated around
one or more of its axes to show multiple sides.

It is further divided into three categories:

a. Isometric Projection: It is a method for visually representing three-dimensional objects in


two-dimensional display in technical and engineering drawings. Here in this projection, the
three coordinate axes appear equally foreshortened and the angle between any two of them is
120 degrees.

b. Dimetric Projection: It is a kind of orthographic projection where the visualized object


appears to have only two adjacent sides and angles are equal.
19 | P a g e

c. Trimetric Projection: It is a kind of orthographic projection where the visualized object


appears to have all the adjacent sides and angles unequal.

3.1.2 Oblique Projec on

It is a kind of parallel projection where projecting rays emerges parallelly from the surface of
the polygon and incident at an angle other than 90 degrees on the plane. It is of two kinds:

1. Cavalier Projection: It is a kind of oblique projection where the projecting lines emerge
parallelly from the object surface and incident at 45° rather than 90° at the projecting plane. In
this projection, the length of the reading axis is larger than the cabinet projection.
20 | P a g e

2. Cabinet Projection: It is similar to the cavalier projection but here the length of reading
axes is half than the cavalier projection and the incident angle at the projecting plane is 63.4°
rather 45°.

3.2 Perspective Projection

In Perspective Projection the center of projection is at finite distance from projection plane.
This projection produces realistic views but does not preserve relative proportions of an object
dimensions. Projections of distant object are smaller than projections of objects of same size
that are closer to projection plane.

1. Center of Projection – It is a point where lines or projection that are not parallel to
projection plane appear to meet.

2. View Plane or Projection Plane – The view plane is determined by :

 View reference point R0(x0, y0, z0)

 View plane normal.

3. Location of an Object – It is specified by a point P that is located in world coordinates


at (x, y, z) location. The objective of perspective projection is to determine the image
point P’ whose coordinates are (x’, y’, z’)

The perspective projection, on the other hand, produces realistic views but does not preserve
relative proportions.

In perspective projection, the lines of projection are not parallel. Instead, they all converge at
a single point called the center of projection or projection reference point.
21 | P a g e

The object positions are transformed to the view plane along these converged projection lines
and the projected view of an object is determined by calculating the intersection of the
converged projection lines with the view plane, as shown in the figure below:

Types of Perspective Projection: Classification of perspective projection is on basis of


vanishing points (It is a point in image where a parallel line through center of projection
intersects view plane.). We can say that a vanishing point is a point where projection line
intersects view plane.

3.2.1 One-Point Perspec ve Projec on

One point perspective projection occurs when any of principal axes intersects with projection
plane or we can say when projection plane is perpendicular to principal axis.

In the above figure, z axis intersects projection plane whereas x and y axis remain parallel to
projection plane.
22 | P a g e

3.2.2 Two-Point Perspec ve Projec on

Two-point perspective projection occurs when projection plane intersects two of principal axis.

In the above figure, projection plane intersects x and y axis whereas z axis remains parallel to
projection plane.

3.2.3 Three-Point Perspec ve Projec on

Three-point perspective projection occurs when all three axis intersects with projection plane.
There isn’t any principal axis which is parallel to projection plane.

3.3 Difference between Orthographic and Isometric Projection

Orthographic Projection Isometric Projection

Provides a 2D view of the object. Provides a 3D view of the object.


Each view of orthographic projection shows Isometric projection displays at least three
only one side of the object. sides of the object.
23 | P a g e

In orthographic projection, the projection In isometric projection, the projection plane


plane is parallel to one of the principal is not parallel to any of the principal planes.
planes.
It does not preserve depth. It does include depth.
The true shape and size of an object are The projected object is foreshortened equally
preserved. in all three directions.

3.4 Difference between Parallel and Perspective Projection

Parallel Projection Perspective projection


Parallel projection represents the object in a Perspective projection represents the object
different way like telescope. in three-dimensional way.
In parallel projection, such effects are not In perspective projection, objects that are far
created. away appear smaller, and objects that are
near appear bigger.
The distance of the object from the center of The distance of the object from the center of
projection is infinite. projection is finite.
Parallel projection can give the accurate view Perspective projection cannot give the
of object. accurate view of object.
It does not form realistic view of object. It forms a realistic view of object.
The lines of parallel projection are parallel. The lines of perspective projection are not
parallel.

Numerical Problems:
Q1. Find transformation of a triangle A(1, 0) B(0, 1) C(1, 1) by performing translation by
one unit in x and y directions and then rotating 45° about the origin.

Solution: Given: A(1, 0) B(0, 1) C(1, 1)

Representing the triangle by Homogeneous Matrix Form:

1 0 1
𝑃(𝑋, 𝑌) = 0 1 1
1 1 1

For translation of 1 unit in X and Y directions, the translation matrix will be:
24 | P a g e

1 0 0
𝑇 = 0 1 0
1 1 1

To find the translation of 1 unit:

𝑀(𝑋′, 𝑌′) = 𝑀(𝑋, 𝑌) ⋅ 𝑇

1 0 1 1 0 0 2 1 1
𝑃(𝑋′, 𝑌′) = 0 1 1 × 0 1 0 = 1 2 1
1 1 1 1 1 1 2 2 1

Now, we need to rotate this triangle by 45° about origin.

𝑐𝑜𝑠 𝜃 𝑠𝑖𝑛 𝜃 0
𝑅 = – 𝑠𝑖𝑛 𝜃 𝑐𝑜𝑠 𝜃 0
0 0 1

2 1 1 𝑐𝑜𝑠 45 𝑠𝑖𝑛 45 0 0.7 2.1 1


𝑃(𝑋′′, 𝑌′′) = 1 2 1 ∗ – 𝑠𝑖𝑛 45 𝑐𝑜𝑠 45 0 = – 0.7 2.1 1
2 2 1 0 0 1 0 2.8 1

Therefore, the final coordinates are A(0.7, 2.1), B(–0.7, 2.1), C(0, 2.8).

Q2. Given a circle C with radius 5 and center coordinates (1, 4). Apply the translation
with distance 5 towards X axis and 1 towards Y axis. Obtain the new coordinates of C
without changing its radius.

Solution: Initial center of the circle: (x,y) = (1,4)

Translation: 5 units towards the x-axis and 1 unit towards the y-axis

To find the new coordinates of the center, add the translation values to the current coordinates:

New center = (x + tx, y + ty)

Where:

 x=1 (initial x-coordinate)

 y=4 (initial y-coordinate)

 tx=5 (translation along the x-axis)

 ty=1 (translation along the y-axis)

New center = (1+5, 4+1) = (6,5)


25 | P a g e

 The new coordinates of the circle after translation are (6,5).

Q3. Given a line segment with starting point as (0, 0) and ending point as (4, 4). Apply 30°
rotation in the anticlockwise direction on the line segment and find out the new
coordinates of the line.

Solution: The 2D rotation matrix for a counterclockwise rotation by an angle θ is:

For a rotation of θ = 30°, we know

So, the rotation matrix begins:

0.866 – 0.5
𝑅(30°) =
0.5 0.866

We will apply this rotation matrix to both points of the line segment.

Rotation of Starting Point (0,0)

The starting point (0,0) remains the same after the rotation because rotating the origin results
in no change.

Rotation of Ending Point (4,4)

Now apply the rotation matrix to the point (4,4):

𝑥′ 𝑥
= 𝑅(30°) 𝑦
𝑦′
26 | P a g e

0.866 – 0.5 4
=
0.5 0.866 4

1.464
=
5.464

Thus, the new coordinates of the line segment after a 30° anticlockwise rotation are (0,0) for
the starting point and approximately (1.464, 5.464) for the ending point.

Q4. Consider the square A (1, 0), B(0, 0), C(0, 1), D (1, 1). Rotate the square ABCD by 45º
anticlockwise about point A (1,0).

Solution: Given: A (1, 0), B(0, 0), C(0, 1), D (1, 1)

Representing the square by Homogeneous Matrix Form:

1 0 1
0 0 1
M=
0 1 1
1 1 1

For translation, tx = –1, ty = 0, as we have to bring the point A(1,0) to origin.

1 0 1 0 0 1
1 0 0
0 0 1 −1 0 1
× 0 1 0 =
0 1 1 −1 1 1
−1 0 1
1 1 1 0 1 1

So, the square after translation has the vertices, A′ (0, 0), B′ (−1, 0), C′ (−1, 1), D′ (0, 1)

We will now rotate the translated square 45º anticlockwise using the 2D rotation matrix. The
rotation matrix for a 45º anticlockwise rotation is:

𝑐𝑜𝑠 𝜃 𝑠𝑖𝑛 𝜃 0
𝑅(𝜃) = – 𝑠𝑖𝑛 𝜃 𝑐𝑜𝑠 𝜃 0
0 0 1

𝑐𝑜𝑠 45° 𝑠𝑖𝑛 45° 0 0.707 0.707 0


𝑅(45°) = – 𝑠𝑖𝑛 45° 𝑐𝑜𝑠 45° 0 = – 0.707 0.707 0
0 0 1 0 0 1

0 0 1 0 0 1
0.707 0.707 0
−1 0 1 −0.707 −0.707 1
× – 0.707 0.707 0 =
−1 1 1 −1.414 0 1
0 0 1
0 1 1 −0.707 0.707 1

We will apply this rotation matrix to the new coordinates A′, B′, C′, D′.

The new coordinates are A′′ (0, 0), B′′ (–0.707, –0.707), C′′ (–1.414, 0), D′′ (–0.707, 0.707).
27 | P a g e

Now we translate the points back to their original positions with tx = 1 and ty = 0:

0 0 1 1 0 1
1 0 0
−0.707 −0.707 1 0.293 −0.707 1
× 0 1 0 =
−1.414 0 1 −0.414 0 1
1 0 1
−0.707 0.707 1 0.293 0.707 1

After rotating the square ABCD by 45º anticlockwise about point A(1,0)A(1, 0)A(1,0), the new
coordinates of the vertices are A (1,0), B (0.293,−0.707), C (−0.414,0), D (0.293,0.707).

𝟐 𝟒 𝟒
Q5. A triangle is defined by . Find transformed coordinates after the following
𝟐 𝟐 𝟒
transformation.

i) 90° rotation about the origin.

ii) Reflection about line X = Y

Solution:

Given a triangle with vertices defined by the matrix:

Here, the first row represents the x-coordinates, and the second row represents the y-
coordinates of the three vertices of the triangle: (2,2), (4,2), and (4,4).

i) 90º Rotation about the Origin

The transformation matrix for a 90º counterclockwise rotation about the origin is:

We multiply this matrix by the original coordinates of the triangle:

Performing the matrix multiplication:


28 | P a g e

So, the new coordinates of the triangle after a 90º rotation are: (−2,2), (−2,4), (−4,4)

ii) Reflection about the Line X=Y

The transformation matrix for reflecting a point about the line X=Y is

We multiply this reflection matrix by the new coordinates of the triangle:

−2 −2 −4 0 1 −2 −2 −4
New coordinates = RX=Y × = ×
2 4 4 1 0 2 4 4

Performing the matrix multiplication:

(0 ⋅ −2) + (1 ⋅ 2) (0 ⋅ −2) + (1 ⋅ 4) (0 ⋅ −4) + (1 ⋅ 4)


=
(1 ⋅ −2) + (0 ⋅ 2) (1 ⋅ −2) + (0 ⋅ 4) (1 ⋅ −4) + (0 ⋅ 4)

2 4 4
=
−2 −2 −4

So, the new coordinates of the triangle after reflection about the line X=Y are (2, –2), (4, –2)
and (4, –4)

Q6. Perform 45° rotation of a triangle A(0, 0), B(1, 1) and C(5, 2). Find transformed
coordinates after rotation, (i) About origin, (ii) About P (–1, 1).

Solution: Given: A(0, 0), B(1, 1) and C(5, 2)

0 0 1
𝑃(𝑋, 𝑌) = 1 1 1
5 2 1

𝑐𝑜𝑠 45° 𝑠𝑖𝑛 45° 0 0.707 0.707 0


𝑅(45°) = – 𝑠𝑖𝑛 45° 𝑐𝑜𝑠 45° 0 = – 0.707 0.707 0
0 0 1 0 0 1

i) 45º Rotation About the Origin

0 0 1 0.707 0.707 0 0 0 1
𝑃(𝑋′, 𝑌′) = 1 1 1 × – 0.707 0.707 0 = 0 1.414 1
5 2 1 0 0 1 2.121 4.949 1

So, the new coordinates are A(0, 0), B(0, 1.414), C(2.121, 4.95).

ii) 45º Rotation About Point P(−1,1)


29 | P a g e

Given: A(0, 0), B(1, 1) and C(5, 2)

To rotate about a point other than the origin, we first translate the point P (−1,1) to the origin,
perform the rotation, and then translate back.

Therefore, tx = 1 and ty = −1

1 0 0
𝑇 = 0 1 0
−1 1 1

0 0 1 1 0 0 1 −1 1
𝑃(𝑋 , 𝑌 ) = 𝑃(𝑋, 𝑌) × 𝑇 = 1 1 1 × 0 1 0 = 2 0 1
5 2 1 1 −1 1 6 1 1

The new coordinates are A’(1, –1), B’(2, 0) and C’(6, 1).

Now we apply the rotation matrix to the translated coordinates.

1 −1 1 1 −1 1 𝑐𝑜𝑠 45° 𝑠𝑖𝑛 45° 0


2 0 1 × 𝑅(45°) = 2 0 1 × – 𝑠𝑖𝑛 45° 𝑐𝑜𝑠 45° 0
6 1 1 6 1 1 0 0 1

1 −1 1 0.707 0.707 0 1.414 0 1


= 2 0 1 × – 0.707 0.707 0 = 1.414 1.414 1
6 1 1 0 0 1 3.535 4.949 1

The new coordinates are A’’(1.414, 0), B’’(1.414, 1.414) and C’’(3.535, 4.949).

Now we translate the rotated triangle back by adding the coordinates of point P(−1,1).
Therefore, tx = −1 and ty = 1

1.414 0 1 1 0 0 0.414 1 1
1.414 1.414 1 × 0 1 0 = 0.414 2.414 0
3.535 4.949 1 −1 1 1 2.535 5.949 1

The new coordinates are A(0.414, 1), B(0.414, 2.414) and C’’(2.535, 5.949).

Q7. Consider a polygon with 4 sides as follow P1(1, 1), P2(3, 1), P3(3, 3), P4(1, 3). Scale
this polygon to half of its size.

Solution: Given: P1(1, 1), P2(3, 1), P3(3, 3), P4(1, 3)

To scale the polygon with vertices P1(1,1), P2(3,1), P3(3,3) and P4(1,3) to half its size, we'll
apply a scaling transformation.

Scaling Transformation Formula:


30 | P a g e

The scaling transformation for 2D coordinates is given by:

Sx and Sy are the scaling factors for the x and y axes, respectively.

In this case, since we want to scale the polygon to half its size, Sx = Sy = 0.5

1 1 1 0.5 0.5 1
0.5 0 0
3 1 1 1.5 0.5 1
× 0 0.5 0 =
3 3 1 1.5 1.5 1
0 0 1
1 3 1 0.5 1.5 1

The new coordinates are P1(0.5,0.5), P2(1.5,0.5), P3(1.5,1.5) and P4(0.5,1.5).

You might also like