I'm trying to learn OpenGL to make a "faster" playable version...

and I'm trying to put the camera in the snake head, so that it will be played in 1st person...

but I have problems with the 4d rotations...

I'm using now, this

Code:

def rot_to_coord4(p_coord):
r = p_coord[0]
theta1 = p_coord[1]
theta2 = p_coord[2]
phi = p_coord[3]
x = r*cos(theta1)
y = r*sin(theta1)*cos(theta2)
z = r*sin(theta1)*sin(theta2)*cos(phi)
w = r*sin(theta1)*sin(theta2)*sin(phi)
return V4(x,y,z,w)
def coord_to_rot4(v):
x = v.c[0]
if x == 0:
x = 0.00000001
y = v.c[1]
if y == 0:
y = 0.00000001
z = v.c[2]
if z == 0:
z = 0.00000001
w = v.c[3]
if abs(w) < 1*pow(10,-5):
w = 0.00000001
r = v.module()
theta1 = atan(1/(x/sqrt(w**2+z**2+y**2)))
print "theta1",degrees(theta1)
theta2 = atan(1/(y/sqrt(w**2+z**2)))
print "theta2",degrees(theta2)
d = ((sqrt(w**2+z**2)+z)/w)
if d == 0:
d = 0.000001
phi = 2*atan(1/d)
print "phi", degrees(phi)
return [r,theta1,theta2,phi]

but doesn't work really good...

do anyone knows how 4d quaternion could look like?