3D Rotation in Computer Graphics

The 3D rotation is different from 2D rotation. In 3D Rotation we also have to define the angle of Rotation with the axis of Rotation.

For Example-Let us assume,

The initial coordinates of an object = (x0, y0, z0)

The Initial angle from origin = ?

The Rotation angle = ?

The new coordinates after Rotation = (x1, y1, z1)

In Three-dimensional plane we can define Rotation by following three ways

  1. X-axis Rotation: We can rotate the object along x-axis. We can rotate an object by using following equation-

X1 = x0

Y1 = y0 cos?z0 x sin?

Z1 = y0 x sin?+ z0 x cos?

We can represent 3D rotation in the form of matrix-

2. Y-axis Rotation: We can rotate the object along y-axis. We can rotate an object by using following equation-

x1 = z0 x sin? + x0 x cos?

y1 = y0

z1 = y0 x cos? x0 x sin?

We can represent 3D rotation in the form of matrix

3. Z-axis Rotation: We can rotate the object along z-axis. We can rotate an object by using following equation-

x1 = x0 x cos? y0 x sin?

y1 = x0 x sin? + y0 x cos?

z1 = z0

We can represent 3D rotation in the form of matrix

Example: A Point has coordinates P (2, 3, 4) in x, y, z-direction. The Rotation angle is 90 degrees. Apply the rotation in x, y, z direction, and find out the new coordinates of the point?

Solution: The initial coordinates of point = P (x0, y0, z0) = (2, 3, 4)

Rotation angle (?) = 90°

For x-axis

Let the new coordinates = (x1, y1, z1) then,

x1= x0 = 2

y1= y0 x cos? — z0 x sin? = 3 x cos90°– 4 x sin90° = 3 x 0–4 x 1 = -4

z1= y0 x sin? + z0 x cos? = 3 x sin90°+ 4 x cos90° = 3 x 1 + 4 x 0 = 3

The new coordinates of point = (2, -4, 3)

For y-axis

Let the new coordinates = (x1, y1, z1) then,

X1= z0 x sin? + x0 x cos? = 4 x sin90° + 2 x cos90° = 4 x 1 + 2 x 0 = 4

y1= y0 = 3

z1= y0 x cos&? — x0 x sin? = 3 x cos90°– 2 x sin90° = 3 x 0–4 x 0 = 0

The new coordinates of point = (4, 3, 0)

For z-axis

Let the new coordinates = (x1, y1, z1) then,

x1= x0 x cos? — y0 x sin? = 2 x cos90° — 3 x sin90° = 2 x 0 + 3 x 1 = 3

y1= x0 x sin? + y0 x cos? = 2 x sin90° ­+ 3 x cos90° = 2 x 1 + 3 x 0 = 2

z1= z0 =4

The New Coordinates of points = (3, 2, 4)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store