This is from our computer graphics class:
We have a unit sphere centered at the origin
We are given a rotation matrix R and a perspective projection matrix P
Let p be a unit vector that lies on the sphere.
and so c is the screen coordinate of p after being rotated by R and then projected using P.
Now for the question:
We are now provided with a different c which we shall call c1 and told that P and p remain the same. The question is what rotation matrix R1 will take p to c1?
Obviously this will produce an underconstrained system so the constraints are defined to be that R is composed of two axis rotations Rx(phi) (rotation of phi about x) and Rz(theta) (rotation of theta about z) such that
So the question boils down to
solve c1=P*Rz(theta)*Rx(phi)*p for theta and phi
You may assume that inv(P) exists or that we know the value of inv(P)*c1