tcElevationOptimization::loadSnapShot: simplify reliability expression
[tecorrec.git] / maths / glQuaternion.h
blobedd1232537736e95471e048bb50106f4f004e1a2
1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
5 * Tecorrec is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * Tecorrec is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with Tecorrec. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
21 * glQuaternion.h
23 * Inline function helpers for GLquaternion<t> classes (from maths library)
24 * These are overloaded to take multiple data types
25 * Header for basic data types is glBasic.h
29 // Stop multiple inclusions
30 #ifndef _maths_glQuaternion_h_
31 #define _maths_glQuaternion_h_
33 // Maths Library - Quaternion Classes
34 #include "Quaternion.h"
36 namespace maths {
37 namespace gl {
38 // Make use of maths library quaternion classes
39 typedef maths::Quaternion<float> quatf;
40 typedef maths::Quaternion<double> quatd;
44 typedef maths::gl::quatf GLquatf;
45 typedef maths::gl::quatd GLquatd;
47 // Rotate the modelview matrix by a quaternion
48 inline void glRotate(const maths::gl::quatf & q)
50 // Convert the quaternion data into simple axis & angle so that it fits in glRotatef
51 maths::gl::quatf Q = q.ToAxisAngle();
52 // Convert Q.w into degrees (from radians) before passing into OpenGL
53 glRotatef(57.295779513f * Q[3], Q[0], Q[1], Q[2]);
56 // Rotate the modelview matrix by a quaternion
57 inline void glRotate(const maths::gl::quatd & q)
59 // Convert the quaternion data into simple axis & angle so that it fits in glRotatef
60 maths::gl::quatd Q = q.ToAxisAngle();
61 // Convert Q.w into degrees (from radians) before passing into OpenGL
62 glRotated(57.295779513 * Q[3], Q[0], Q[1], Q[2]);
65 #endif