Finding 3D rotation matrix given original and final vector

98 Views Asked by At

I have been trying to solve a graphics course test problem. The problem statement is,

"A camera in 3D is located at point (1, 2, 3) and looks at point (-3, 5, 3). The up direction of the camera is aligned with positive Z axis. Now, you need the camera to be shifted at point (-1, -2, -3) and it will look along direction i+j with up direction -i+j. Determine the corresponding view transformation matrix with appropriate explanation. You do not need to multiply the matrix."

I know I need to make a translation and then a rotation. I am facing problem finding the rotation matrix.

My approach was,
Let's assume, axis of rotation is unit vector, $\mathbf{K}( k_{x} ,k_{y} ,k_{z})$
angle of rotation, $$
using Rodrigues Formula,
$$ R=\begin{bmatrix} k_{x}^{2}( 1-cos\theta ) +cos\theta & k_{y} k_{x}( 1-cos\theta ) -k_{z} sin\theta & k_{z} k_{x}( 1-cos\theta ) +k_{y} sin\theta \\ k_{x} k_{y}( 1-cos\theta ) +k_{z} sin\theta & k_{y}^{2}( 1-cos\theta ) +cos\theta & k_{z} k_{y}( 1-cos\theta ) -k_{x} sin\theta \\ k_{x} k_{z}( 1-cos\theta ) -k_{y} sin\theta & k_{y} k_{z}( 1-cos\theta ) +k_{x} sin\theta & k_{z}^{2}( 1-cos\theta ) +cos\theta \end{bmatrix} $$ Now, I have to solve $6$ equations which I can get from the two original and rotated directions (look and up vector).

Is there any other approach that would help me solve this in an easier way, or this is what I am expected to do?