sphere coordinates and trigonometry