[dali_1.0.15] Merge branch 'tizen'
[platform/core/uifw/dali-core.git] / dali / public-api / math / radian.h
1 #ifndef __DALI_RADIAN_H__
2 #define __DALI_RADIAN_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23
24 namespace Dali
25 {
26
27 struct Degree;
28
29 /**
30  * @brief An angle in radians.
31  *
32  * This reduces ambiguity when using methods which accept angles in degrees or radians.
33  */
34 struct DALI_IMPORT_API Radian
35 {
36   /**
37    * @brief Create an angle in radians.
38    *
39    * @param[in] value The initial value in radians.
40    */
41   explicit Radian( float value );
42
43   /**
44    * @brief Create an angle in radians from an angle in degrees.
45    *
46    * @param[in] value The initial value in degrees.
47    */
48   Radian( const Degree& value );
49
50   /**
51    * @brief Compare equality between two radians.
52    *
53    * @param[in] rhs Radian to compare to
54    * @return true if the value is identical
55    */
56   bool operator==( const Radian& rhs ) const;
57
58   /**
59    * @brief Compare inequality between two radians.
60    *
61    * @param[in] rhs Radian to compare to
62    * @return true if the value is not identical
63    */
64   bool operator!=( const Radian& rhs ) const;
65
66   /**
67    * @brief Compare two radians.
68    *
69    * @param[in] rhs Radian to compare to
70    * @return true if this is less than the value
71    */
72   bool operator<( const Radian& rhs ) const;
73
74   /**
75    * @brief Assign an angle from a float value.
76    *
77    * @param[in] value Float value in radians
78    * @return a reference to this object
79    */
80   Radian& operator=( const float value );
81
82   /**
83    * @brief Assign an angle in degrees to a Radian.
84    *
85    * @param[in] rhs Degree to get the value from
86    * @return a reference to this object
87    */
88   Radian& operator=( const Degree& rhs );
89
90   /**
91    * @brief Cast operator to const float reference.
92    */
93   operator const float&() const;
94
95   /**
96    * @brief Cast operator to float reference.
97    */
98   operator float&();
99
100 private:
101   // member data
102   float mValue; ///< The value in radians
103
104   // disable default constructor
105   Radian();
106 };
107
108 } // namespace Dali
109
110 #endif // __DALI_RADIAN_H__