Update doxygen comments
[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 // EXTERNAL INCLUDES
22 #include <iosfwd>
23 #include <ostream>
24
25 // INTERNAL INCLUDES
26 #include <dali/public-api/math/radian.h>
27 #include <dali/public-api/math/vector3.h>
28
29 namespace Dali
30 {
31 /**
32  * @addtogroup dali_core_object
33  * @{
34  */
35
36 struct Radian;
37
38 /**
39  * @brief An angle & axis pair.
40  *
41  * This is slightly easier to understand than quaternions for handling rotations
42  * of objects. Both elements should be non-zero to correctly describe a rotation.
43  * @SINCE_1_0.0
44  */
45 struct AngleAxis
46 {
47   /**
48    * @brief Creates an angle-axis pair.
49    * @SINCE_1_0.0
50    */
51   AngleAxis()
52   : angle(0.0f),
53     axis(0.0f, 0.0f, 0.0f)
54   { }
55
56   /**
57    * @brief Creates an angle-axis pair.
58    *
59    * @SINCE_1_0.0
60    * @param[in] initialAngle The initial angle in radians
61    * @param[in] initialAxis The initial axis
62    */
63   AngleAxis( Radian initialAngle, const Vector3& initialAxis )
64   : angle( initialAngle ),
65     axis( initialAxis )
66   { }
67
68   Radian angle; ///< The angle in radians
69   Vector3 axis; ///< The axis
70
71 };
72
73 // Compiler generated destructor, copy constructor and assignment operators are ok as this class is POD
74
75 /**
76  * @brief Compares two angle axis for equality.
77  *
78  * @SINCE_1_0.0
79  * @param lhs angle axis
80  * @param rhs angle axis
81  * @return True if they are equal
82  */
83 inline bool operator==( const Dali::AngleAxis& lhs, const Dali::AngleAxis& rhs )
84 {
85   return (lhs.angle == rhs.angle) && (lhs.axis == rhs.axis);
86 }
87
88 /**
89  * @brief Prints an angle axis.
90  *
91  * @SINCE_1_1.33
92  * @param[in] o The output stream operator
93  * @param[in] angleAxis The angle axis to print
94  * @return The output stream operator
95  */
96 inline std::ostream& operator<< (std::ostream& o, const Dali::AngleAxis& angleAxis)
97 {
98   return o << "[ Axis: [" << angleAxis.axis.x << ", " << angleAxis.axis.y << ", " << angleAxis.axis.z << "], Angle: " << Degree( angleAxis.angle ).degree << " degrees ]";
99 }
100
101 /**
102  * @}
103  */
104 } // namespace Dali
105
106 #endif // __DALI_ANGLE_AXIS_H__