Maybe this fits in math.stackexchange.com, but since I am programing it in OpenGL, I shall ask it here.
I had the idea of an spaceship game where the world is confined in the surface of an 4-D hypersphere (also called a 3-sphere). Thus, in seeing it from inside, it would look like a 3-D world, but by navigating in every direction, I would never leave the limited volume of the 3-sphere.
To represent the 3-shpere as a "flat" 3-D space, I use an stereographic projection, which is very simple to implement as a GLSL shader, just need to divide the input vector by one minus its w coordinate.
To represent the vertices of the objects I am using normalized 4d vectors, such that x²+y²+z²+w²=1, thus keeping them inside the 3-sphere.
The first problem to solve was rotation. But I soon figured out that ordinary 3d rotation matrices would suffice to rotate the world around the viewer in the 3d projection, since it does not mess up with the w coordinate (pretty much like rotating a sphere around the z-axis would also rotate its stereographic projection).
Then I figured out that rotating along w-axis would be equivalent of translation inside the 3d projection (just not commutative, as ordinary 3d translations on "flat" spaces), then I could translate along the axis by using a simple around axis rotation matrix (x', y') = (x * cos a - y * sin a, x * sin a + y * cos a), but variating w along with another axis.
This is so far where I got, and I could not figure out how to navigate forward, based on the position the viewer is facing from the projection. I can apply the inverse transform to derive the normalized 4-D vector (called F) the viewer is facing in the hypersphere coordinates, but I don't know how to navigate in that direction by using a 4x4 matrix (what is optimal in OpenGL). I could think on a hackish solution: for every vertex V, do V' = normalize(d*F + V), where d is the distance moved forward (in some strange unit I can not exactly precise). This way only works for small values of d, there is no direct correlation between d and the angle variation.
Thus the question is: how to move forward (using a 4x4 matrix transform) being in the surface of a 4-D hypersphere?