12 #ifndef ECL_GEOMETRY_ANGLE_HPP_ 13 #define ECL_GEOMETRY_ANGLE_HPP_ 20 #include <ecl/config/macros.hpp> 21 #include <ecl/linear_algebra.hpp> 22 #include <ecl/type_traits/fundamental_types.hpp> 23 #include <ecl/mpl/enable_if.hpp> 24 #include <ecl/math/constants.hpp> 42 static const T rads_to_degs = 180.0/
pi;
43 return radians*rads_to_degs;
55 static const T degs_to_rads =
pi/180.0;
56 return degrees*degs_to_rads;
112 template <
class T,
typename Enable =
void>
135 template <
typename T>
136 class ECL_PUBLIC Angle<T, typename enable_if<is_float<T> >::type> {
141 typedef ecl::linear_algebra::Matrix<T,2,2> RotationMatrix;
155 Angle(
const RotationMatrix &rotation) {
156 value = std::atan2(rotation(1,0),rotation(0,0));
168 const Angle<T>& operator=(
const T &angle);
205 void operator+=(
const Angle<T> &angle);
239 void operator-=(
const Angle<T> &angle);
270 operator const T&()
const {
return value; }
287 RotationMatrix rotationMatrix()
const {
288 T c = std::cos(
value);
290 return (RotationMatrix() << c, -s, s, c).finished();
306 static Angle<T> Degrees(
const T &angle);
320 static Angle<T> Radians(
const T &angle);
334 template <
typename T>
339 template <
typename T>
350 template <
typename T>
355 template <
typename T>
360 template <
typename T>
366 template <
typename T>
368 value += angle.value;
372 template <
typename T>
377 template <
typename T>
382 template <
typename T>
388 template <
typename T>
390 value -= angle.value;
394 template <
typename T>
399 template <
typename T>
409 template <
typename T>
414 template <
typename T>
TFSIMD_FORCE_INLINE Vector3 operator*(const Matrix3x3 &m, const Vector3 &v)
TFSIMD_FORCE_INLINE Quaternion operator-(const Quaternion &q)
ecl_geometry_PUBLIC T radians_to_degrees(const T &radians, typename enable_if< ecl::is_float< T > >::type *dummy=0)
Converts radians to degrees and returns the result.
Default action for detection of a fundamental float type (false).
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
ecl_geometry_PUBLIC T degrees_to_radians(const T °rees, typename enable_if< ecl::is_float< T > >::type *dummy=0)
Converts degrees to radians and returns the result.
#define ecl_geometry_PUBLIC
TFSIMD_FORCE_INLINE Vector3 & operator-=(const Vector3 &v)
TFSIMD_FORCE_INLINE Vector3 & operator+=(const Vector3 &v)
TFSIMD_FORCE_INLINE Vector3 & operator*=(const tfScalar &s)
ecl_geometry_PUBLIC const float & wrap_angle(float &angle)
Wrap the angle on -pi,pi (float types).
Parent template definition for angles.
const GenericPointer< typename T::ValueType > T2 value
TFSIMD_FORCE_INLINE Vector3 operator+(const Vector3 &v1, const Vector3 &v2)
Enables the SFINAE concept.