Does it have something to do perhaps with arcsin returning a limit between PI/2 and -PI/2?
? No, there are just many coordinate systems in use, for instance XY horizontal plane and Z vertical axis, XZ horizontal plane and Y vertical axis, sometimes the Z axis goes in the negative direction, etc... these are all conventions and you just need to transform the formula from the coordinate system used by Wikipedia into the coordinate system you are using, otherwise it doesn't make sense. The formula is equivalent, it is just in a different (no less valid) coordinate system.
For instance the conventional "up" vector would be (0, 1, 0) in a coordinate system where Y is the vertical axis, if you were to import a model containing such vectors in an application which uses a coordinate system where Z is the vertical axis, you would need to transform the vector to one coordinate system to the other so that it still correctly points upwards, in this case it would involve swapping the Y and Z coordinates, so the new vector would be (0, 0, 1) which is correct.
Alright, this is how I understood it as well. Well basically that's what I've been doing, transforming the formula in wiki (and many other materials) to one suited for my need. I had a hard time understanding first though how all of these can be equivalent and still get confused by it from time to time

My point is you're converting degrees to radians, then feeding the resulting numbers (which are in radians) back into the degree-to-radian conversion functions. I'm not sure how you expect this to work, but it will always produce incorrect results, because you never convert back to degrees anywhere.
[edit] Don't mind me, I can't read. You are indeed converting back to degrees. It just seems really wasteful to go back and forth all the time and it's going to complicate your math and lead to incorrect conversions like this if you happen to make a mistake.
As you said it's most likely wasteful and it will eventually lead to incorrect conversions (as can be seen in the data below). But I don't see how this is keeping it locked at 90-91 degrees.
This is a wild guess but while I checked the data printed out by the conversion the problem seem to be when my z-coordinate gets to really low values..that and it never goes below zero. It gets really weird, I'll print out some values to show. First two lines show the current stored coordinate in both cartesian and spherical form. The two following ones shows the stored coordinate after adding one to theta.
Cartesian coord: (-2.89778, 0, -0.776461)
Spherical coord: (3, 75, 0)
Spherical coord.(after adding 1 to theta): (3, 76, 0)
Cartesian coord.(after adding 1 to theta): (-2.91089, 0, -0.72577)
Cartesian coord: (-2.91089, 0, -0.72577)
Spherical coord: (3, 76, 0)
Spherical coord.(after adding 1 to theta): (3, 77, 0)
Cartesian coord.(after adding 1 to theta): (-2.92311, 0, -0.674858)
Cartesian coord: (-2.92311, 0, -0.674858)
Spherical coord: (3, 77, 0)
Spherical coord.(after adding 1 to theta): (3, 78, 0)
Cartesian coord.(after adding 1 to theta): (-2.93444, 0, -0.62374)
Cartesian coord: (-2.93444, 0, -0.62374)
Spherical coord: (3, 78, 0)
Spherical coord.(after adding 1 to theta): (3, 79, 0)
Cartesian coord.(after adding 1 to theta): (-2.94488, 0, -0.572432)
Cartesian coord: (-2.94488, 0, -0.572432)
Spherical coord: (3, 79, 0)
Spherical coord.(after adding 1 to theta): (3, 80, 0)
Cartesian coord.(after adding 1 to theta): (-2.95442, 0, -0.52095)
Cartesian coord: (-2.95442, 0, -0.52095)
Spherical coord: (3, 80, 0)
Spherical coord.(after adding 1 to theta): (3, 81, 0)
Cartesian coord.(after adding 1 to theta): (-2.96306, 0, -0.469309)
Cartesian coord: (-2.96306, 0, -0.469309)
Spherical coord: (3, 81, 0)
Spherical coord.(after adding 1 to theta): (3, 82, 0)
Cartesian coord.(after adding 1 to theta): (-2.9708, 0, -0.417525)
Cartesian coord: (-2.9708, 0, -0.417525)
Spherical coord: (3, 82, 0)
Spherical coord.(after adding 1 to theta): (3, 83, 0)
Cartesian coord.(after adding 1 to theta): (-2.97764, 0, -0.365614)
Cartesian coord: (-2.97764, 0, -0.365614)
Spherical coord: (3, 83, 0)
Spherical coord.(after adding 1 to theta): (3, 84, 0)
Cartesian coord.(after adding 1 to theta): (-2.98357, 0, -0.313591)
Cartesian coord: (-2.98357, 0, -0.313591)
Spherical coord: (3, 83.9999, 0)
Spherical coord.(after adding 1 to theta): (3, 84.9999, 0)
Cartesian coord.(after adding 1 to theta): (-2.98858, 0, -0.261474)
Cartesian coord: (-2.98858, 0, -0.261474)
Spherical coord: (3, 85, 0)
Spherical coord.(after adding 1 to theta): (3, 86, 0)
Cartesian coord.(after adding 1 to theta): (-2.99269, 0, -0.209275)
Cartesian coord: (-2.99269, 0, -0.209275)
Spherical coord: (3, 85.9999, 0)
Spherical coord.(after adding 1 to theta): (3, 86.9999, 0)
Cartesian coord.(after adding 1 to theta): (-2.99589, 0, -0.157014)
Cartesian coord: (-2.99589, 0, -0.157014)
Spherical coord: (3, 86.9999, 0)
Spherical coord.(after adding 1 to theta): (3, 87.9999, 0)
Cartesian coord.(after adding 1 to theta): (-2.99817, 0, -0.104707)
Cartesian coord: (-2.99817, 0, -0.104707)
Spherical coord: (3, 87.9998, 0)
Spherical coord.(after adding 1 to theta): (3, 88.9998, 0)
Cartesian coord.(after adding 1 to theta): (-2.99954, 0, -0.0523715)
Cartesian coord: (-2.99954, 0, -0.0523715)
Spherical coord: (3, 88.9997, 0)
Spherical coord.(after adding 1 to theta): (3, 89.9997, 0)
Cartesian coord.(after adding 1 to theta): (-3, 0, -1.77503e-005)
Cartesian coord: (-3, 0, -1.77503e-005)
Spherical coord: (3, 90.0001, 0)
Spherical coord.(after adding 1 to theta): (3, 91.0001, 0)
Cartesian coord.(after adding 1 to theta): (-2.99954, 0, 0.0523574)
Cartesian coord: (-2.99954, 0, 0.0523574)
Spherical coord: (3, 89.0001, 0)
Spherical coord.(after adding 1 to theta): (3, 90.0001, 0)
Cartesian coord.(after adding 1 to theta): (-3, 0, 2.63453e-006)
Cartesian coord: (-3, 0, 2.63453e-006)
Spherical coord: (3, 90.0001, 0)
Spherical coord.(after adding 1 to theta): (3, 91.0001, 0)
Cartesian coord.(after adding 1 to theta): (-2.99954, 0, 0.0523574)
Edited by Suen, 12 May 2012 - 05:25 PM.