Merge "Adding AK8975 geo-sensor info in sensors.xml.in required by geo-plugin" into...
[platform/core/system/sensord.git] / src / sensor_fusion / quaternion.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef _QUATERNION_H
21 #define _QUATERNION_H
22
23 #include "vector.h"
24
25 template <typename TYPE>
26 class quaternion {
27 public:
28         vect<TYPE> m_quat;
29
30         quaternion();
31         quaternion(const TYPE w, const TYPE x, const TYPE y, const TYPE z);
32         quaternion(const vect<TYPE> v);
33         quaternion(const quaternion<TYPE>& q);
34         ~quaternion();
35
36         quaternion<TYPE> operator =(const quaternion<TYPE>& q);
37         void quat_normalize();
38
39         template<typename T> friend quaternion<T> operator *(const quaternion<T> q,
40                         const T val);
41         template<typename T> friend quaternion<T> operator *(const quaternion<T> q1,
42                         const quaternion<T> q2);
43         template<typename T> friend quaternion<T> operator +(const quaternion<T> q1,
44                         const quaternion<T> q2);
45
46         template<typename T> friend quaternion<T> quat_conj(const quaternion<T> q);
47 };
48
49 #include "quaternion.cpp"
50
51 #endif  //_QUATERNION_H