Trigonometry in 3d