|
Rosetta
|
Euler angles 3-D orientation representation. More...
#include <EulerAngles.hh>

Public Member Functions | |
| EulerAngles () | |
| Default constructor. More... | |
| EulerAngles (xyzVector< T > const &v) | |
| Copy constructor. More... | |
| EulerAngles (Value const &phi, Value const &psi, Value const &theta) | |
| Triple value constructor. More... | |
| EulerAngles (xyzMatrix< T > rotation_matrix) | |
| Construct from rotation matrix. More... | |
| ~EulerAngles () | |
| Destructor. More... | |
| void | from_rotation_matrix (xyzMatrix< T > matrix) |
| xyzMatrix< T > | to_rotation_matrix () |
| Construct rotation matrix from three euler angles that describe the frame. See the description for from_rotation_matrix to understand the Z-X-Z transformation convention. More... | |
| Value & | phi () |
| Value phi in radians. More... | |
| void | phi (Value const &value) |
| Set value phi in radians. More... | |
| Value & | phi_radians () |
| Value phi in radians. More... | |
| void | phi_radians (Value const &value) |
| Set value phi in radians. More... | |
| Value | phi_degrees () |
| Value phi in degrees. More... | |
| void | phi_degrees (Value const &value) |
| Set value phi in degrees. More... | |
| Value & | psi () |
| Value psi in radians. More... | |
| void | psi (Value const &value) |
| Set value psi in radians. More... | |
| Value & | psi_radians () |
| Value psi in radians. More... | |
| void | psi_radians (Value const &value) |
| Set value psi in radians. More... | |
| Value | psi_degrees () |
| Value psi in degrees. More... | |
| void | psi_degrees (Value const &value) |
| Set value psi in degrees. More... | |
| Value & | theta () |
| Value theta in radians. More... | |
| void | theta (Value const &value) |
| Set value theta in radians. More... | |
| Value & | theta_radians () |
| Value theta in radians. More... | |
| void | theta_radians (Value const &value) |
| Set value theta in radians. More... | |
| Value | theta_degrees () |
| Value theta in degrees. More... | |
| void | theta_degrees (Value const &value) |
| Set value theta in degrees. More... | |
Public Member Functions inherited from numeric::xyzVector< T > | |
| xyzVector () | |
| Default constructor. More... | |
| xyzVector (xyzVector const &v) | |
| Copy constructor. More... | |
| template<typename U > | |
| xyzVector (xyzVector< U > const &v) | |
| Copy constructor. More... | |
| xyzVector (Value const &t) | |
| Uniform value constructor. More... | |
| xyzVector (Value const &x_a, Value const &y_a, Value const &z_a) | |
| Triple value constructor. More... | |
| template<typename U > | |
| xyzVector (U const *p) | |
| Pointer to contiguous values constructor. More... | |
| ~xyzVector () | |
| Destructor. More... | |
| xyzVector & | operator= (xyzVector const &v) |
| Copy assignment. More... | |
| template<typename U > | |
| xyzVector & | operator= (xyzVector< U > const &v) |
| Copy assignment. More... | |
| template<typename U > | |
| xyzVector & | operator= (U const *p) |
| Assignment from pointer to contiguous values. More... | |
| template<typename U > | |
| xyzVector & | operator+= (xyzVector< U > const &v) |
| += xyzVector More... | |
| template<typename U > | |
| xyzVector & | operator-= (xyzVector< U > const &v) |
| -= xyzVector More... | |
| template<typename U > | |
| xyzVector & | scaled_assign (Value const &t, xyzVector< U > const &v) |
| Assign Value * xyzVector. More... | |
| template<typename U > | |
| xyzVector & | scaled_add (Value const &t, xyzVector< U > const &v) |
| Add Value * xyzVector. More... | |
| template<typename U > | |
| xyzVector & | scaled_sub (Value const &t, xyzVector< U > const &v) |
| Subtract Value * xyzVector. More... | |
| xyzVector & | operator= (Value const &t) |
| = Value More... | |
| xyzVector & | operator+= (Value const &t) |
| += Value More... | |
| xyzVector & | operator-= (Value const &t) |
| -= Value More... | |
| xyzVector & | operator*= (Value const &t) |
| *= Value More... | |
| xyzVector & | operator/= (Value const &t) |
| /= Value More... | |
| xyzVector & | assign (Value const &x_a, Value const &y_a, Value const &z_a) |
| Triple value assignment. More... | |
| bool | is_finite () const |
| Test if there's any non-finite (inf, NAN) values in the vector. More... | |
| std::string | to_string () const |
| to_string, useful for utility exits More... | |
| xyzVector & | clear () |
| Clear. More... | |
| xyzVector & | zero () |
| Zero. More... | |
| xyzVector & | negate () |
| Negate. More... | |
| xyzVector | operator- () const |
| -xyzVector (negated copy) More... | |
| xyzVector | negated () const |
| Negated copy. More... | |
| void | negated (xyzVector &a) const |
| Negated: Return via argument (slightly faster) More... | |
| xyzVector & | min (xyzVector const &v) |
| Set minimum coordinates wrt another xyzVector. More... | |
| xyzVector & | max (xyzVector const &v) |
| Set maximum coordinates wrt another xyzVector. More... | |
| xyzVector & | normalize () |
| Normalize. More... | |
| T | minimum_value () const |
| get the lowest of the three values in the vector More... | |
| T | maximum_value () const |
| get the highest of the three values in the vector More... | |
| void | normalized (xyzVector &a) const |
| Normalized. More... | |
| xyzVector & | normalize_or_zero () |
| Normalize: zero xyzVector if length is zero. More... | |
| void | normalized_or_zero (xyzVector &a) const |
| Normalized: zero xyzVector if length is zero. More... | |
| xyzVector & | normalize_any () |
| Normalize: arbitrary normalized xyzVector if length is zero. More... | |
| void | normalized_any (xyzVector &a) const |
| Normalized: arbitrary normalized xyzVector if length is zero. More... | |
| xyzVector & | normalize (Value const &length_a) |
| Normalize to a length. More... | |
| void | normalized (Value const &length_a, xyzVector &a) const |
| Normalized to a length. More... | |
| xyzVector & | normalize_or_zero (Value const &length_a) |
| Normalize to a length: zero xyzVector if length is zero. More... | |
| void | normalized_or_zero (Value const &length_a, xyzVector &a) const |
| Normalized to a length: zero xyzVector if length is zero. More... | |
| xyzVector & | normalize_any (Value const &length_a) |
| Normalize to a length: arbitrary normalized xyzVector if length is zero. More... | |
| void | normalized_any (Value const &length_a, xyzVector &a) const |
| Normalized to a length: arbitrary normalized xyzVector if length is zero. More... | |
| xyzVector | normalized () const |
| Normalized copy. More... | |
| xyzVector | normalized_or_zero () const |
| Normalized copy: Zero xyzVector if length is zero. More... | |
| xyzVector | normalized_any () const |
| Normalized copy: Arbitrary normalized xyzVector if length is zero. More... | |
| xyzVector | normalized (Value const &length_a) const |
| Normalized to a length copy. More... | |
| xyzVector | normalized_or_zero (Value const &length_a) const |
| Normalized to a length copy: Zero xyzVector if length is zero. More... | |
| xyzVector | normalized_any (Value const &length_a) const |
| Normalized to a length copy: Arbitrary normalized xyzVector if length is zero. More... | |
| xyzVector & | project_normal (xyzVector const &v) |
| Project normal. More... | |
| xyzVector | projected_normal (xyzVector const &v) const |
| Projected normal copy. More... | |
| void | projected_normal (xyzVector const &v, xyzVector &a) const |
| Projected normal. More... | |
| xyzVector & | project_parallel (xyzVector const &v) |
| Project parallel. More... | |
| xyzVector | projected_parallel (xyzVector const &v) const |
| Projected parallel copy. More... | |
| void | projected_parallel (xyzVector const &v, xyzVector &a) |
| Projected parallel. More... | |
| Value | distance (xyzVector const &v) const |
| Distance. More... | |
| Value | distance_squared (xyzVector const &v) const |
| Distance. More... | |
| Value | dot (xyzVector const &v) const |
| Distance squared. More... | |
| Value | dot_product (xyzVector const &v) const |
| Dot product. More... | |
| Value | inner_product (xyzVector const &v) const |
| Inner product ( == dot product ) More... | |
| xyzVector | cross (xyzVector const &v) const |
| Cross product. More... | |
| xyzVector | cross_product (xyzVector const &v) const |
| Cross product. More... | |
| bool | is_zero () const |
| Is zero? More... | |
| bool | is_normalized () const |
| Is exactly normalized? More... | |
| bool | is_normalized (Value const &tol) const |
| Is normalized to within a tolerance? More... | |
| bool | is_unit () const |
| Is exactly a unit vector? More... | |
| bool | is_unit (Value const &tol) const |
| Is a unit vector to within a tolerance? More... | |
| Value const & | x () const |
| Value x const. More... | |
| Value & | x () |
| Value x. More... | |
| Value const & | y () const |
| Value y const. More... | |
| Value & | y () |
| Value y. More... | |
| Value const & | z () const |
| Value z const. More... | |
| Value & | z () |
| Value z. More... | |
| Value | length () const |
| Length. More... | |
| Value | length_squared () const |
| Length squared. More... | |
| Value | norm () const |
| Norm. More... | |
| Value | norm_squared () const |
| Norm squared. More... | |
| Value | magnitude () const |
| Magnitude. More... | |
| Value | magnitude_squared () const |
| Magnitude squared. More... | |
| void | x (Value const &x_a) |
| x assignment More... | |
| void | y (Value const &y_a) |
| y assignment More... | |
| void | z (Value const &z_a) |
| z assignment More... | |
| Value const & | operator[] (int const i) const |
| xyzVector[ i ] const: 0-based index More... | |
| Value & | operator[] (int const i) |
| xyzVector[ i ]: 0-based index More... | |
| Value const & | operator() (int const i) const |
| xyzVector( i ) const: 1-based index More... | |
| Value & | operator() (int const i) |
| xyzVector( i ): 1-based index More... | |
| bool | equal_length (xyzVector const &v) |
| Equal length? More... | |
| bool | not_equal_length (xyzVector const &v) |
| Not equal length? More... | |
| template<typename U > | |
| bool | not_equal_length (xyzVector< U > const &a, xyzVector< U > const &b) |
| Not equal length? More... | |
| bool | longer (xyzVector const &v) |
| Longer? More... | |
| bool | longer_or_equal (xyzVector const &v) |
| Longer or equal length? More... | |
| bool | shorter (xyzVector const &v) |
| Shorter? More... | |
| bool | shorter_or_equal (xyzVector const &v) |
| Shorter or equal length? More... | |
Static Public Member Functions | |
| static T | angular_distance_between (EulerAngles< T > a1, EulerAngles< T > a2) |
| Get angular distance between two sets of Euler Angles. More... | |
| static EulerAngles< T > | from_degrees (T phi, T psi, T theta) |
| static EulerAngles< T > | from_degrees (xyzVector< T > vector) |
| static EulerAngles< T > | from_radians (T phi, T psi, T theta) |
| static EulerAngles< T > | from_radians (xyzVector< T > vector) |
Private Types | |
| typedef xyzVector< T > | Vector |
| typedef xyzMatrix< T > | Matrix |
| typedef T | Value |
Additional Inherited Members | |
Public Types inherited from numeric::xyzVector< T > | |
| typedef T | Value |
| typedef T & | Reference |
| typedef T const & | ConstReference |
| typedef T * | Pointer |
| typedef T const * | ConstPointer |
| typedef T | value_type |
| typedef T & | reference |
| typedef T const & | const_reference |
| typedef T * | pointer |
| typedef T const * | const_pointer |
| typedef void | iterator_category |
| typedef void | difference_type |
Euler angles 3-D orientation representation.
The range of phi is ( -pi, pi ]; The range of psi is ( -pi, pi ]; The range of theta is [ 0, pi ];
|
private |
|
private |
|
private |
|
inline |
Default constructor.
|
inline |
Copy constructor.
|
inline |
Triple value constructor.
|
inline |
Construct from rotation matrix.
References numeric::EulerAngles< T >::from_rotation_matrix(), and numeric::xyzVector< T >::rotation_matrix.
|
inline |
Destructor.
|
inlinestatic |
Get angular distance between two sets of Euler Angles.
References docking::a1, docking::a2, 3d_histogram::rotation, and numeric::rotation_angle().
|
inlinestatic |
|
inlinestatic |
References numeric::conversions::radians().
|
inlinestatic |
|
inlinestatic |
|
inline |
The equivalent rotation matrix representation of the euler angles would be:
FIGURE 1: R = [ cos(psi)cos(phi)-cos(theta)sin(phi)sin(psi) cos(psi)sin(phi)+cos(theta)cos(phi)sin(psi) sin(psi)sin(theta) -sin(psi)cos(phi)-cos(theta)sin(phi)cos(psi) -sin(psi)sin(phi)+cos(theta)cos(phi)cos(psi) cos(psi)sin(theta) sin(theta)sin(phi) -sin(theta)cos(phi) cos(theta) ]
The zz_ coordinate gives away theta. Theta may be computed as acos( zz_ ), or, as Alex does it, asin( sqrt( 1 - zz^2)) Since there is redundancy in theta, this->function chooses a theta with a positive sin(theta): i.e. quadrants I and II. Assuming we have a positive sin theta pushes phi and psi into conforming angles.
NOTE on theta: asin returns a value in the range [ -pi/2, pi/2 ], and we have artificially created a positive sin(theta), so we will get a asin( pos_sin_theta ), we have a value in the range [ 0, pi/2 ]. To convert this->into the actual angle theta, we examine the zz sign. If zz is negative, we chose the quadrant II theta. That is, asin( pos_sin_theta) returned an angle, call it theta'. Now, if cos( theta ) is negative, then we want to choose the positive x-axis rotation that's equivalent to -theta'. To do so, we reflect q through the y axis (See figure 2 below) to get p and then measure theta as pi - theta'.
FIGURE 2:
II | I | p. | .q (cos(-theta'), std::abs(sin(theta'))) . | .
III | IV | The angle between the positive x axis and p is pi - theta'.
Since zx and zy contain only phi terms and a constant sin( theta ) term, phi is given by atan2( sin_phi, cos_phi ) = atan2( c*sin_phi, c*cos_phi ) = atan2( zx, -zy ) for c positive and non-zero. If sin_theta is zero, or very close to zero, we're at gimbal lock.
Moreover, since xz and yz contain only psi terms, psi may also be deduced using atan2.
There are 2 degenerate cases (gimbal lock)
References test.T009_Exceptions::e, matrix, numeric::EulerAngles< T >::phi(), numeric::constants::d::pi, numeric::EulerAngles< T >::psi(), numeric::sin_cos_range(), and numeric::EulerAngles< T >::theta().
Referenced by numeric::EulerAngles< T >::EulerAngles().
|
inline |
Value phi in radians.
References numeric::xyzVector< Real >::x().
Referenced by numeric::EulerAngles< T >::from_degrees(), numeric::EulerAngles< T >::from_radians(), numeric::EulerAngles< T >::from_rotation_matrix(), and numeric::EulerAngles< T >::to_rotation_matrix().
|
inline |
Set value phi in radians.
References value, and numeric::xyzVector< Real >::x().
|
inline |
Value phi in degrees.
References numeric::constants::d::radians_to_degrees, and numeric::xyzVector< Real >::x().
Referenced by main(), pose_from_posedata(), and trim_and_add_jump_data().
|
inline |
Set value phi in degrees.
References numeric::constants::d::degrees_to_radians, value, and numeric::xyzVector< Real >::x().
|
inline |
Value phi in radians.
References numeric::xyzVector< Real >::x().
|
inline |
Set value phi in radians.
References value, and numeric::xyzVector< Real >::x().
|
inline |
Value psi in radians.
References numeric::xyzVector< Real >::y().
Referenced by numeric::EulerAngles< T >::from_degrees(), numeric::EulerAngles< T >::from_radians(), numeric::EulerAngles< T >::from_rotation_matrix(), and numeric::EulerAngles< T >::to_rotation_matrix().
|
inline |
Set value psi in radians.
References value, and numeric::xyzVector< Real >::y().
|
inline |
Value psi in degrees.
References numeric::constants::d::radians_to_degrees, and numeric::xyzVector< Real >::y().
Referenced by main(), pose_from_posedata(), and trim_and_add_jump_data().
|
inline |
Set value psi in degrees.
References numeric::constants::d::degrees_to_radians, value, and numeric::xyzVector< Real >::y().
|
inline |
Value psi in radians.
References numeric::xyzVector< Real >::y().
|
inline |
Set value psi in radians.
References value, and numeric::xyzVector< Real >::y().
|
inline |
Value theta in radians.
References numeric::xyzVector< Real >::z().
Referenced by numeric::EulerAngles< T >::from_degrees(), numeric::EulerAngles< T >::from_radians(), numeric::EulerAngles< T >::from_rotation_matrix(), and numeric::EulerAngles< T >::to_rotation_matrix().
|
inline |
Set value theta in radians.
References value, and numeric::xyzVector< Real >::z().
|
inline |
Value theta in degrees.
References numeric::constants::d::radians_to_degrees, and numeric::xyzVector< Real >::z().
Referenced by main(), pose_from_posedata(), and trim_and_add_jump_data().
|
inline |
Set value theta in degrees.
References numeric::constants::d::degrees_to_radians, value, and numeric::xyzVector< Real >::z().
|
inline |
Value theta in radians.
References numeric::xyzVector< Real >::z().
|
inline |
Set value theta in radians.
References value, and numeric::xyzVector< Real >::z().
|
inline |
Construct rotation matrix from three euler angles that describe the frame. See the description for from_rotation_matrix to understand the Z-X-Z transformation convention.
References kmeans_adaptive_kernel_density_bb_dependent_rotlib::m, numeric::EulerAngles< T >::phi(), numeric::EulerAngles< T >::psi(), and numeric::EulerAngles< T >::theta().
Referenced by main(), and pose_from_posedata().