Bike-X  0.8
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
OVR_Math.cpp
Go to the documentation of this file.
1 /************************************************************************************
2 
3 Filename : OVR_Math.h
4 Content : Implementation of 3D primitives such as vectors, matrices.
5 Created : September 4, 2012
6 Authors : Andrew Reisse, Michael Antonov, Anna Yershova
7 
8 Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
9 
10 Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License");
11 you may not use the Oculus VR Rift SDK except in compliance with the License,
12 which is provided at the time of installation or download, or which
13 otherwise accompanies this software in either electronic or hard copy form.
14 
15 You may obtain a copy of the License at
16 
17 http://www.oculusvr.com/licenses/LICENSE-3.1
18 
19 Unless required by applicable law or agreed to in writing, the Oculus VR SDK
20 distributed under the License is distributed on an "AS IS" BASIS,
21 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 See the License for the specific language governing permissions and
23 limitations under the License.
24 
25 *************************************************************************************/
26 
27 #include "OVR_Math.h"
28 #include "OVR_Log.h"
29 
30 #include <float.h>
31 
32 
33 namespace OVR {
34 
35 
36 //-------------------------------------------------------------------------------------
37 // ***** Math
38 
39 
40 // Single-precision Math constants class.
41 const float Math<float>::Pi = 3.1415926f;
42 const float Math<float>::TwoPi = 3.1415926f * 2;
43 const float Math<float>::PiOver2 = 3.1415926f / 2.0f;
44 const float Math<float>::PiOver4 = 3.1415926f / 4.0f;
45 const float Math<float>::E = 2.7182818f;
46 
47 const float Math<float>::MaxValue = FLT_MAX;
49 
52 
53 const float Math<float>::Tolerance = 0.00001f;
54 const float Math<float>::SingularityRadius = 0.0000001f; // Use for Gimbal lock numerical problems
55 
56 // Double-precision Math constants class.
57 const double Math<double>::Pi = 3.14159265358979;
58 const double Math<double>::TwoPi = 3.14159265358979 * 2;
59 const double Math<double>::PiOver2 = 3.14159265358979 / 2.0;
60 const double Math<double>::PiOver4 = 3.14159265358979 / 4.0;
61 const double Math<double>::E = 2.71828182845905;
62 
63 const double Math<double>::MaxValue = DBL_MAX;
65 
68 
69 const double Math<double>::Tolerance = 0.00001;
70 const double Math<double>::SingularityRadius = 0.000000000001; // Use for Gimbal lock numerical problems
71 
72 
73 
74 //-------------------------------------------------------------------------------------
75 // ***** Matrix4
76 
77 template<>
79  0.0f, 1.0f, 0.0f, 0.0f,
80  0.0f, 0.0f, 1.0f, 0.0f,
81  0.0f, 0.0f, 0.0f, 1.0f);
82 
83 template<>
85  0.0, 1.0, 0.0, 0.0,
86  0.0, 0.0, 1.0, 0.0,
87  0.0, 0.0, 0.0, 1.0);
88 
89 
90 
91 } // Namespace OVR
static const double PiOver2
Definition: OVR_Math.h:204
static const double PiOver4
Definition: OVR_Math.h:205
#define FLT_MAX
static const float SingularityRadius
Definition: OVR_Math.h:191
static const float Pi
Definition: OVR_Math.h:178
static const double SingularityRadius
Definition: OVR_Math.h:215
static const double DegreeToRadFactor
Definition: OVR_Math.h:212
static const float PiOver2
Definition: OVR_Math.h:180
static const float TwoPi
Definition: OVR_Math.h:179
static const double Pi
Definition: OVR_Math.h:202
static const double RadToDegreeFactor
Definition: OVR_Math.h:211
static const float PiOver4
Definition: OVR_Math.h:181
static const double E
Definition: OVR_Math.h:206
static const float RadToDegreeFactor
Definition: OVR_Math.h:187
static const float MaxValue
Definition: OVR_Math.h:184
static const double MinPositiveValue
Definition: OVR_Math.h:209
static const double Tolerance
Definition: OVR_Math.h:214
static const double MaxValue
Definition: OVR_Math.h:208
static const double TwoPi
Definition: OVR_Math.h:203
static const float Tolerance
Definition: OVR_Math.h:190
static const float E
Definition: OVR_Math.h:182
static const float MinPositiveValue
Definition: OVR_Math.h:185
static const float DegreeToRadFactor
Definition: OVR_Math.h:188