Skip to main content

ROTATE AN IMAGE WITH A MATHS OPERATOR




   In Cartesian coordinates, we marked two points P and P1.  The coordinates of P is x, y and that of P1 is x1, y1.  Both are connected to the origin by straight lines.  They make angles A and B with the x-axis respectively.  The length of the lines connecting both the points to the origin is equal and it is   ' r'.  That means, P1 is rotation of the point P by an angle B.  

From the figure we can write

x = r*cosA
y = r*sinA

similarly,
x1 = r*cos (A+B)
y1 = r*sin (A+B)

using trigonometry formula, we can expand the equations.
x1 = r*(cosAcosB - sinAsinB)
y1 = r*(sinAcosB+cosAsinB)

If we substitute x=r*cosA and y= r*sinA in the above equations we get, 
x1 = xcosB -ysinB
y1 = xsinB+ycosB

writing in matrix form,



  So R(B) is a matrix rotation operator.  If we multiply coordinates of any point by the matrix operator R(B), the point will be rotated by an angle B and we will get the new coordinates



.
 The image shown in the figure is letter T.  Assume each square is a pixel (picture element).  Each pixel carries colour information of red, green and blue (RGB intensities)
.
 If you want to rotate the image, then coordinates of each point (pixel) of the image should be multiplied by matrix operator R to get the new coordinates.  Next, RGB info. should be written in the new locations.  Finally we will get tilted image as shown.
  
This is the mathematics of a "rotating tool" in an image editing software.

Science updates:  Reaching absolute zero  - 273.15 degree c temperature is proved to be impossible mathematically.