In a previous blog, Best Position Estimate for a Number of Intersecting Great Circles, I showed how one can find the distance of a point on a sphere from an arc on it. The trick involves finding the point on the arc for which the distance from the point is a minimum. This method can be used to find the angular coordinates of a point, q, on a sphere. The coordinate, φ, is the angular distance to the minimum, a, on the arc in the xy-plane. The second coordinate, θ, is the angular distance from the point a to the point q on the arc in the az-plane. Of course the distance of q from the arc in this case is zero.
This simple process can be extended to any number of dimensions. In a Euclidean 4-space we have the axes x, y, z and w. The distance of the minimum of b from q on the arc in the az-plane will not necessarily be zero in this 4-space. We need another arc in the bw-plane to get to q on the 4-sphere which yields a third angle. Here's an example of how it works in practice.
One can use the atan function to check the angles in the example above. The function er(α) consists of pairs of sines and cosines as indicated in the blog mentioned above with a third sine-cosine pair for the third angle.
For points not on the unit 4-sphere the distance of the point q from the origin will not be unity and a check will show that q = r·er(α) to the precision of the calculation.