Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / public-api / math / radian.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 // CLASS HEADER
18 #include <dali/public-api/math/radian.h>
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/common/constants.h>
22 #include <dali/public-api/math/degree.h>
23
24 namespace
25 {
26 const float PI_OVER_180 = Dali::Math::PI/180.0f;
27 }
28
29 namespace Dali
30 {
31
32 Radian::Radian( float value )
33 : mValue( value )
34 {
35 }
36
37 Radian::Radian( const Degree& degree )
38 : mValue( degree * PI_OVER_180 )
39 {
40 }
41
42 bool Radian::operator==( const Radian& rhs ) const
43 {
44   return fabsf( mValue - rhs.mValue ) < GetRangedEpsilon( mValue, rhs.mValue );
45 }
46
47 bool Radian::operator!=( const Radian& rhs ) const
48 {
49   return !(this->operator==(rhs));
50 }
51
52 bool Radian::operator<( const Radian& rhs ) const
53 {
54   return mValue < rhs.mValue;
55 }
56
57 Radian& Radian::operator=( const float value )
58 {
59   mValue = value;
60   return *this;
61 }
62
63 Radian& Radian::operator=( const Degree& rhs )
64 {
65   mValue = rhs * PI_OVER_180;
66   return *this;
67 }
68
69 Radian::operator const float&() const
70 {
71   return mValue;
72 }
73
74 Radian::operator float&()
75 {
76   return mValue;
77 }
78
79 } // namespace Dali