|
| 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...
|
|
| xyzVector () |
| Default constructor. More...
|
|
| xyzVector (xyzVector const &v) |
| Copy constructor. More...
|
|
| 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...
|
|
| xyzVector (U const *p) |
| Pointer to contiguous values constructor. More...
|
|
| ~xyzVector () |
| Destructor. More...
|
|
xyzVector & | operator= (xyzVector const &v) |
| Copy assignment. More...
|
|
xyzVector & | operator= (xyzVector< U > const &v) |
| Copy assignment. More...
|
|
xyzVector & | operator= (U const *p) |
| Assignment from pointer to contiguous values. More...
|
|
xyzVector & | operator= (Value const &t) |
| = Value More...
|
|
xyzVector & | operator+= (xyzVector< U > const &v) |
| += xyzVector More...
|
|
xyzVector & | operator+= (Value const &t) |
| += Value More...
|
|
xyzVector & | operator-= (xyzVector< U > const &v) |
| -= xyzVector More...
|
|
xyzVector & | operator-= (Value const &t) |
| -= Value More...
|
|
xyzVector & | scaled_assign (Value const &t, xyzVector< U > const &v) |
| Assign Value * xyzVector. More...
|
|
xyzVector & | scaled_add (Value const &t, xyzVector< U > const &v) |
| Add Value * xyzVector. More...
|
|
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 & | assign (Value const &x_a, Value const &y_a, Value const &z_a) |
| Triple value assignment. More...
|
|
std::string | to_string () const |
| to_string, useful for utility exits More...
|
|
void | show (std::ostream &output=std::cout) const |
| Show. 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...
|
|
xyzVector & | normalize (Value const &length_a) |
| Normalize to a length. 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...
|
|
void | normalized (Value const &length_a, xyzVector &a) const |
| Normalized to a length. More...
|
|
xyzVector | normalized () const |
| Normalized copy. More...
|
|
xyzVector | normalized (Value const &length_a) const |
| Normalized to a length copy. More...
|
|
xyzVector & | normalize_or_zero () |
| Normalize: zero xyzVector if length is zero. More...
|
|
xyzVector & | normalize_or_zero (Value const &length_a) |
| Normalize to a length: zero xyzVector if length is zero. More...
|
|
void | normalized_or_zero (xyzVector &a) const |
| Normalized: 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 | normalized_or_zero () const |
| Normalized copy: Zero xyzVector if length is zero. More...
|
|
xyzVector | normalized_or_zero (Value const &length_a) const |
| Normalized to a length copy: Zero xyzVector if length is zero. More...
|
|
xyzVector & | normalize_any () |
| Normalize: arbitrary normalized 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 (xyzVector &a) const |
| Normalized: 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_any () const |
| Normalized copy: Arbitrary normalized 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...
|
|
void | x (Value const &x_a) |
| x assignment More...
|
|
Value const & | y () const |
| Value y const. More...
|
|
Value & | y () |
| Value y. More...
|
|
void | y (Value const &y_a) |
| y assignment More...
|
|
Value const & | z () const |
| Value z const. More...
|
|
Value & | z () |
| Value z. More...
|
|
void | z (Value const &z_a) |
| z assignment 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...
|
|
Value const & | at (int const i) const |
| xyzVector.at: 0-based index with bounds checking More...
|
|
Value & | at (int const i) |
| xyzVector.at: 0-based index with bounds checking 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...
|
|
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...
|
|
template<typename>
class numeric::EulerAngles< typename >
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 ];
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'))) . | .
theta'( . | . ) theta' = asin( std::abs(sin(theta))
| 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)
- theta close to 0 (North Pole singularity), or
- theta close to pi (South Pole singularity) For these, we take: phi=acos(xx), theta = 0 (resp. Pi/2), psi = 0
References numeric::EulerAngles< typename >::phi(), numeric::constants::d::pi, numeric::EulerAngles< typename >::psi(), numeric::sin_cos_range(), basic::T(), numeric::EulerAngles< typename >::theta(), numeric::xyzMatrix< typename >::xx(), numeric::xyzMatrix< typename >::xz(), numeric::xyzMatrix< typename >::yz(), numeric::xyzMatrix< typename >::zx(), numeric::xyzMatrix< typename >::zy(), and numeric::xyzMatrix< typename >::zz().
Referenced by numeric::EulerAngles< typename >::EulerAngles().