iOS/buildlibs/armv7/allegro-4.4.2/addons/allegrogl/examp/excamera.c
/* For display, we'd like to convert the QUAT back to heading, pitch and roll
 * These don't serve any purpose but to make it look human readable.
 * Note: Produces incorrect results.
 */
For display, we'd like to convert the QUAT back to heading, pitch and roll
These don't serve any purpose but to make it look human readable.
Note: Produces incorrect results.
For display we ' d like to convert the QUAT back to heading pitch and roll These don ' t serve any purpose but to make it look human readable . Note : Produces incorrect results .
void convert_quat(QUAT *q, float *heading, float *pitch, float *roll) {
	MATRIX_f matrix;
	quat_to_matrix(q, &matrix);
	*heading = atan2(matrix.v[0][2], matrix.v[0][0]);
	*pitch   = asin(matrix.v[0][1]);
	*roll    = atan2(matrix.v[2][1], matrix.v[2][0]);
}
void convert_quat ( QUAT * q , float * heading , float * pitch , float * roll ) { MATRIX_f matrix ; quat_to_matrix ( q , & matrix ) ; * heading = atan2 ( matrix . v [ 0 ] [ 2 ] , matrix . v [ 0 ] [ 0 ] ) ; * pitch = asin ( matrix . v [ 0 ] [ 1 ] ) ; * roll = atan2 ( matrix . v [ 2 ] [ 1 ] , matrix . v [ 2 ] [ 0 ] ) ; }
For display, we'd like to convert the QUAT back to heading, pitch and roll
 These don't serve any purpose but to make it look human readable.
For display we ' d like to convert the QUAT back to heading pitch and roll These don ' t serve any purpose but to make it look human readable .