I hope this is the proper location to ask this question which is the same as this one, but expressed as pure math instead of graphically (at least I hope I translated the problem to math correctly).
Considering:
- two vectors that are orthogonal: Up (ux, uy, uz) and Look (lx, ly, lz)
- a plane P which is perpendicular to Look (hence including Up)
- Y1 which is the projection of Y (vertical axis) along Look onto P
Question: what is the value of the angle between Y1 and Up?
As mathematicians will agree, this is a very basic question, but I’ve been scratching my head for at least two weeks without being able to visualize how to project Y onto P… maybe now too old for finding solutions to school exercises.
I’m looking for the trigonometric solution, not a solution using a matrix. Thanks.
Edit: I found that I needed to determine the sign of the angle, relative to a rotation axis which had to be Look. I posted the final code on my linked question (see link above). Thanks to those who helped. I appreciate your time.
I’m just doing this on paper. I hope it’s right.
Let’s assume Up and Look are normalized, that is, length 1. Let’s say that plane P contains the origin, and L is its normal. Y is (0, 1, 0)
To project Y onto P, find its distance to P…
…and then scale the normal by -d to get the Y1 (that is, the projection of Y on P)
Now normalize Y1, that is, scale it by (1 / length). If its length was 0 then you’re out of luck.
The dot product of Y1 and Up = the cosine of the angle. So