# How to project the surface of a hypersphere into the full volume of a sphere?

The game I mentioned in "Navigating though the surface of a hypersphere in a computer game" is taking shape in here. The world is a 3-sphere where everything belongs. In Euclidean coordinates, for every point $x^2 + y^2 + z^2 + w^2 = 1$. We move the objects by applying orthornormal transformations to them.

We got to a stage where we want to draw a mini-map to help the user navigate through the space, and that is the subject of this question. Like we use stereographic projection to get the 3-sphere into 3-D Euclidean space, how can we project the points of the 3-sphere into the full volume of a "common" 2-sphere? This way, all world objects could be seen in a cool sphere drawn in the corner of the screen, unlike it is with the stereographic projection, which is infinite and some points may be missing in the cropping.

Considering every point $P = (x, y, z, w) \; | \; x^2 + y^2 + z^2 + w^2 = 1$, we need a function $t$ where $t(P) = (X, Y, Z) \; | \; X^2 + Y^2 + Z^2 \leq 1$ and $t((0,0,0,-1)) = (0,0,0)$ (the center of the stereographic projection). Every point of the 3-sphere except $(0,0,0,1)$ must be defined. What is this function? I am not sure on how to look for it...

It's a cool game idea. However, the map you're looking for cannot be called a stereographic projection. Stereographic projection projects a sphere onto a whole infinite plane or, in this case, infinite 3-dimensional space $R^3$.
Imagine that you have such a map $t(P)$ and you are thinking what points $M$ of the 3-sphere get mapped onto - or near - the boundary of the 3-ball, the 2-sphere. Clearly, $M$ must be some singular manifold inside the $S^3$ which is diffeomorphic to an $S^2$. The points of the 3-sphere on the opposite side of the $M$ cannot be found in the 3-ball, as long as the map is one-to-one.
What you could do - if you want to preserve the angles - would be to divide the $S^3$ into the upper and lower hemisphere, $w>0$ or $w<0$, for example, and these two hemispheres are then very close to and naturally mapped to a 3-ball. In this case, you may use the standard stereographic projection and because of the removal of the wrong hemisphere, the infinite 3-plane will shrink to a 3-ball. But you would get two such 3-balls, not one.
Alternatively, you may sacrifice the conservation of the angles and you may "compactify" the 3-plane from the normal stereographic projection by mapping (using polar coordinates) $$(r,\theta,\phi) \to (\arctan r,\theta,\phi).$$ I used arctan because it maps $(0,\infty)$ to a finite interval; $\tanh r$ would do the job, too. And there are others (and simpler) such as $r/(1+r)$. As expected, the angles will be severely distorted near the boundary of the 3-ball which will correspond to the vicinity of the removed pole of the 3-sphere.