Trigonometry in 3D