written 8.3 years ago by | • modified 8.3 years ago |
Mumbai university > Comp > SEM 4 > Computer Graphics
Marks: 12M
Year: May 2015, Dec 2015
written 8.3 years ago by | • modified 8.3 years ago |
Mumbai university > Comp > SEM 4 > Computer Graphics
Marks: 12M
Year: May 2015, Dec 2015
written 8.3 years ago by |
2D rotation section aims at enabling the transformation matrix for rotating any object by some angle Ө.
Rotation of a geometric model about an arbitrary axis, other than any of the coordinate axes, involves several rotational and translation transformations.
When we rotate an object about the origin (in 2-D), we in fact rotate it about the z-axis.
Every point on the object rotates along a circular path, with the center of rotation at the origin.
If we wish to rotate an object about an arbitrary axis, which is perpendicular to the xy-plane, we will have to first translate the axis to the origin and then rotate the model, and finally, translate so that the axis of rotation is restored to its initial position.
If we erroneously use the equation (2.9) directly, to rotate the object about a fixed axis, and skip the translation of this point to the origin, we will in fact end up rotating the object about the z-axis, and not about the fixed axis.
Thus, the rotation of an object about an arbitrary axis, involves three steps:
Step 1: Translate the fixed axis so that it coincides with the z-axis
Step 2: Rotate the object about the axis
Step 3: Translate the fixed axis back to the original position
Derivation of matrix of 2D object about an arbitrary axis
Consider a position vector from origin to point P(x, y).
Let ‘r’ be the length of vector and ‘ɸ’ be the angle of the vector with x-axis.
It is required to rotate the point P by an angle Ө in anti-clockwise direction: the point P is now shifted to point P* i.e. (x, y).
The position vector
$$P = [x, y] = [r cosɸ, r sinɸ]$$ and
$$P* = [x, y] = [r cos (Ө + ɸ), r sin(Ө + ɸ)]$$
$$x* = r cos(Ө + ɸ)$$
$$x* = r cosӨcosɸ - rsinӨsinɸ$$
$$y = r sinɸ$$
$$x* = (r cosɸ) cosӨ –(r sinɸ) sinӨ$$
$$x* = x cosӨ – y sinӨ$$
$$y* = r sin(Ө + ɸ)$$
$$ = r sinӨcosɸ + r cosӨsinɸ$$
$$ = (r cosɸ) sin Ө + (r sin ɸ)cosӨ$$
$$y = r sinɸ$$
$$y* = x sinӨ + ycosӨ$$
$$y* = x sin Ө + ycosӨ$$
$$[X*] = [X] [T]$$
$$[x* y*] = [x y] [T]$$
$$ [xcosӨ – y sinӨ x sinӨ+ y cosӨ] = [x y] [T]$$
$$(cosӨ \ \ sinӨ@-sinӨ \ \ cosӨ)= [T]$$
$$|T| = cos^2Ө + sin^2Ө = 1$$