1 #ifndef DALI_ANGLE_AXIS_H
2 #define DALI_ANGLE_AXIS_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
26 #include <dali/public-api/math/radian.h>
27 #include <dali/public-api/math/vector3.h>
32 * @addtogroup dali_core_math
39 * @brief An angle & axis pair.
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.
48 * @brief Creates an angle-axis pair.
53 axis(0.0f, 0.0f, 0.0f)
57 * @brief Creates an angle-axis pair.
60 * @param[in] initialAngle The initial angle in radians
61 * @param[in] initialAxis The initial axis
63 AngleAxis( Radian initialAngle, const Vector3& initialAxis )
64 : angle( initialAngle ),
70 AngleAxis( const AngleAxis& ) = default; ///< Default copy constructor
71 AngleAxis( AngleAxis&& ) = default; ///< Default move constructor
72 AngleAxis& operator=( const AngleAxis& ) = default; ///< Default copy assignment operator
73 AngleAxis& operator=( AngleAxis&& ) = default; ///< Default move assignment operator
77 Radian angle; ///< The angle in radians
78 Vector3 axis; ///< The axis
82 // Compiler generated destructor, copy constructor and assignment operators are ok as this class is POD
85 * @brief Compares two angle axis for equality.
88 * @param lhs angle axis
89 * @param rhs angle axis
90 * @return True if they are equal
92 inline bool operator==( const Dali::AngleAxis& lhs, const Dali::AngleAxis& rhs )
94 return (lhs.angle == rhs.angle) && (lhs.axis == rhs.axis);
98 * @brief Prints an angle axis.
101 * @param[in] o The output stream operator
102 * @param[in] angleAxis The angle axis to print
103 * @return The output stream operator
105 inline std::ostream& operator<< (std::ostream& o, const Dali::AngleAxis& angleAxis)
107 return o << "[ Axis: [" << angleAxis.axis.x << ", " << angleAxis.axis.y << ", " << angleAxis.axis.z << "], Angle: " << Degree( angleAxis.angle ).degree << " degrees ]";
115 #endif // DALI_ANGLE_AXIS_H