12 #ifndef ECL_GEOMETRY_ANGLE_HPP_ 13 #define ECL_GEOMETRY_ANGLE_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>
155 Angle(
const RotationMatrix &rotation) {
156 value = std::atan2(rotation(1,0),rotation(0,0));
168 const Angle<T>& operator=(
const T &angle);
180 Angle<T> operator+(
const T &angle)
const;
197 void operator+=(
const T &angle);
205 void operator+=(
const Angle<T> &angle);
214 Angle<T> operator-(
const T &angle)
const;
231 void operator-=(
const T &angle);
239 void operator-=(
const Angle<T> &angle);
248 Angle<T> operator*(
const T &scalar)
const;
256 void operator*=(
const T &scalar);
270 operator const T&()
const {
return value; }
288 T c = std::cos(value);
289 T s = std::sin(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>
Angle(const RotationMatrix &rotation)
Construct from a 2x2 rotation matrix.
Embedded control libraries.
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.
#define ecl_geometry_PUBLIC
Angle()
Prevents usage of this template class directly.
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.
ecl_geometry_PUBLIC const float & wrap_angle(float &angle)
Wrap the angle on -pi,pi (float types).
Parent template definition for angles.
Angle(const T &angle=0.0)
Constructs an angle in radians.
ecl::linear_algebra::Matrix< T, 2, 2 > RotationMatrix
RotationMatrix rotationMatrix() const
Convert to a 2x2 rotation matrix.