2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiEffects_UtilsCommon.h
20 * @brief The common math functions and constants
24 #ifndef _FUI_EFFECTS_INTERNAL_UTILS_COMMON_H_
25 #define _FUI_EFFECTS_INTERNAL_UTILS_COMMON_H_
30 namespace Tizen { namespace Ui { namespace Effects { namespace _Utils
32 const float fEPS = std::numeric_limits<float>::epsilon();
33 const double dEPS = std::numeric_limits<double>::epsilon();
35 const double dPI_2 = 6.283185307179586232;
36 const double dPI = dPI_2 * 0.5;
37 const float fPI_2 = float(dPI_2);
38 const float fPI = float(dPI);
40 const double dDEG2RADCoeff = dPI / 180.0;
41 const double dRAD2DEGCoeff = 180.0 / dPI;
42 const float fDEG2RADCoeff = float(dDEG2RADCoeff);
43 const float fRAD2DEGCoeff = float(dRAD2DEGCoeff);
45 inline double dDEG2RAD(double aDEG) {return aDEG * dDEG2RADCoeff;}
46 inline float fDEG2RAD(float aDEG) {return aDEG * fDEG2RADCoeff;}
47 inline double dRAD2DEG(double aRAD) {return aRAD * dRAD2DEGCoeff;}
48 inline float fRAD2DEG(float aRAD) {return aRAD * fRAD2DEGCoeff;}
50 enum RotationOrder3 {ROTATION_XYZ = 0, ROTATION_XZY, ROTATION_YXZ, ROTATION_YZX, ROTATION_ZXY, ROTATION_ZYX, ROTATION3_MAX};
52 template<class T> inline bool isPowerOf2(T aValue) //only for positive integes
54 return (aValue & (aValue - T(1))) == T(0);
56 } } } } //Tizen::Ui::Effects::_Utils
58 #endif //_FUI_EFFECTS_INTERNAL_UTILS_COMMON_H_