I have a view direction in 3d space described with 2 values: Horizontal and Vertical (x and y) ranging the full 360 degrees (from -180 to +180), thus describing every possible view direction.
It seems fairly straight forward to me, that the angle between (0,0) and (5,0) would be 5 degrees.
But what is the angle between (0,0) and (5,5). If it was 2 points in 2d I would use Pythagoras theorem; having the difference be sqrt(5^2 + 5^2). But I don't think that would apply in 3d? How do I go about calculating the angle between these 2 directions?
This has likely been asked before, but I probably don't know the correct wording. I assume the "view directions" should be calculated as vectors, but I'm not sure how.
Thanks
If I understood well, by a "direction" ($\phi, \theta)$ (I assume the angles between $0$ and $2 \pi$) you mean the unit vector $u(\phi, \theta) = (\cos \theta \cos \phi, \cos \theta \sin \phi, \sin \theta)$. The angle $\alpha$ between $u(\theta, \phi)$ and $u(\theta', \phi')$ may be calculated by taking the scalar product $u(\theta, \phi) \cdot u(\theta', \phi')$ as follows: $$ \cos \alpha = \cos \theta \cos \theta' (\cos \phi \cos \phi' + \sin \phi \sin \phi') + \sin \theta \sin \theta' = \cos \theta \cos \theta' \cos (\phi-\phi') + \sin \theta \sin \theta', $$ hence $$ \alpha = \cos^{-1} (\cos \theta \cos \theta' \cos (\phi-\phi') + \sin \theta \sin \theta') $$