Graphics

Numerical Examples of Rotation in 2d Transformation


Example – 2 (from Exams)

Rotate a triangle placed at A(0,0), B(1,1) and C(5,2) by an angle 45 with respect to point P(-1,-1).


The calculations available for computer graphics can be performed only at origin. It is a case of composite transformation which means this can be performed when more than one transformation is performed.

The following composite transformation matrix would be performed as follows.

  • First bring the Point P(-1,-1) to the origin => which means translation towards origin => towards origin will be negative translation. So tx and ty values would be negative. So tx =- (-1) = 1 and ty = – (-1) = 1.
  • Perform the rotation of 45 degrees.
  • Send the point P(-1,-1) back => which mean translation away from origin => Away from origin would be positive translation therefore tx and ty will be positive. So tx = -1 and ty = -1.
  • The most important point: the composite matrix should be written from right to left , So the composite rotation matrix would be = T(x) * R(Theta) * T(-x) and NOT T(-x) * R(Theta) * T(x)

The composite rotation matrix would be = Positive translation * Rotation (45degree) * Negative translation.

Substitute of values of translation and rotation angle.


The composite Transformation

Multiply the resultant rotation matrix with the triangle matrix.

The final resultant matrix will be as follows.

The Final Resultant Matrix

Problem Statement

Example -2:

Rotate a triangle placed at A(0,0), B(1,1) and C(5,2) by an angle 45 with respect to origin.

In this case since one of the edges of the triangle (A) is already at origin so after performing the transformation the values of A should not change, which will act as a check. We will multiply the object matrix with the rotation matrix to get the solution.

Remember: If direction of the rotation is not given then always assume it be positive. 

The more complex problem is handled in the example two where the rotation is happening with respect to a point other than origin.

S-1: The triangle coordinates should also be written in the matrix form, shown as follows. The rotation matrix is also given below.

On Left is Triangle Matrix and Rotation Matrix is placed on Right

S-2: Put the value of angle in the rotation matrix (Angle given in problem statement is 45 degrees. Also put the values of cos 45 and sin 45 degrees in the matrix. The value of sin and cos 45 degrees is 1/sqrt(2).

Putting the values of rotation

S-3: Multiply these matrices to get the resultant matrix, which would describe the new coordinates of the edges of the triangle after 45 degrees rotation.

New Coordinates of Triangle – A'(0,0) , B'(0,2/sqrt(2)) and C'(3/sqrt(2), 8/sqrt(2))
sr_2018

Recent Posts

Entrepreneurship UNIT-2 ENTREPRENEURIAL PLANNING ClassXII

NOTES UNIT-2 ENTREPRENEURIAL PLANNING CLASS-XII SUBJECT- ENTREPRENEURSHIP

3 years ago

Color Generating Techniques- Computer Graphics

There are two ways by which you can see some objects colorful, let's say RED…

4 years ago

MCQs on Moving Charges and Magnetism – Ch-4 Class 12

What is the formula of Lorentz force  q = charge B = Magnetic Fields E…

4 years ago

MCQs on Electrostatic Potential & Capacitance -ch 2 Class 12

MCQs on Electrostatic Potential & Capacitance - Chapter 2 - Class 12 CBSELove to Learn…

4 years ago

MCQs – Electric Charges – Chapter 1

A. Which out of the following are conductors Metal Human Body Animal Bodies Earth All…

4 years ago

MCQs on Solutions – Chapter -2

MCQs with answer explanation on - Solutions Chapter -2 Class 12 Prepared by Experts MCQ…

4 years ago