[opensource-dev] converting degrees into quaternions

CJ Davies cjohndavies at gmail.com
Tue Jul 31 03:54:27 PDT 2012


I've been struggling with this for 2 days now & am no closer to working 
it out (despite investigating all sorts of examples online, including 
the SL wiki).

I have a accelerometer/magnetometer that tells me orientation via 
compass bearing, pitch & roll. All of these are in degrees which can 
easily be converted to radians via foo*DEG_TO_RAD. I want to plug these 
values into llcoordframe methods to control where the camera points. All 
of the llcoordframe stuff works in quaternions & I can't for the life of 
me convert properly.

I've just tried following this approach --> 
http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm

But this results in output like this --> http://paste2.org/p/2089138

Note how the calculated w/x/y/z values change drastically with tiny 
changes in the bearing/pitch/roll, eg between lines 43 & 50 (the 
accelerometer/magnetometer was motionless on the desk at the time!).

Any help greatly appreciated.

Regards,
CJ Davies


More information about the opensource-dev mailing list