Change Property::Value::Get methods to return bool so developer can check if conversi...
[platform/core/uifw/dali-core.git] / dali / public-api / math / angle-axis.h
1 #ifndef __DALI_ANGLE_AXIS_H__
2 #define __DALI_ANGLE_AXIS_H__
3
4 /*
5  * Copyright (c) 2015 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/math/radian.h>
23 #include <dali/public-api/math/vector3.h>
24
25 namespace Dali
26 {
27
28 struct Radian;
29
30 /**
31  * @brief An angle & axis pair.
32  *
33  * This is slightly easier to understand than quaternions for handling rotations
34  * of objects. Both elements should be non-zero to correctly describe a rotation.
35  */
36 struct AngleAxis
37 {
38   /**
39    * @brief Create an angle-axis pair.
40    */
41   AngleAxis()
42   : angle(0.0f),
43     axis(0.0f, 0.0f, 0.0f)
44   { }
45
46   /**
47    * @brief Create an angle-axis pair.
48    *
49    * @param[in] initialAngle The initial angle in radians.
50    * @param[in] initialAxis The initial axis.
51    */
52   AngleAxis( Radian initialAngle, const Vector3& initialAxis )
53   : angle( initialAngle ),
54     axis( initialAxis )
55   { }
56
57   Radian angle; ///< The angle in radians
58   Vector3 axis; ///< The axis
59
60 };
61
62 // compiler generated destructor, copy constructor and assignment operators are ok as this class is POD
63
64 /**
65  * @brief Compare two angle axis for equality
66  *
67  * @param lhs angle axis
68  * @param rhs angle axis
69  * @return true if they are equal
70  */
71 inline bool operator==( const Dali::AngleAxis& lhs, const Dali::AngleAxis& rhs )
72 {
73   return (lhs.angle == rhs.angle) && (lhs.axis == rhs.axis);
74 }
75
76 } // namespace Dali
77
78 #endif // __DALI_ANGLE_AXIS_H__