![]() |
Rosetta
2021.16
|
#include <HomogeneousTransform.hh>
Public Types | |
| typedef T | value_type |
Public Member Functions | |
| HomogeneousTransform () | |
| Default constructor: axis aligned with the global coordinate frame and the point located at the origin. More... | |
| HomogeneousTransform (xyzVector< T > const &p1, xyzVector< T > const &p2, xyzVector< T > const &p3) | |
| Construct the coordinate frame from the points defined such that. More... | |
| HomogeneousTransform (xyzVector< T > const &xaxis, xyzVector< T > const &yaxis, xyzVector< T > const &zaxis, xyzVector< T > const &point) | |
| Constructor from xyzVectors: trust that the axis are indeed orthoganol. More... | |
| HomogeneousTransform (xyzMatrix< T > const &axes, xyzVector< T > const &point) | |
| Constructor from an xyzMatrix and xyzVectors: trust that the axis are indeed orthoganol. More... | |
| value_type | xx () const |
| value_type | xy () const |
| value_type | xz () const |
| value_type | yx () const |
| value_type | yy () const |
| value_type | yz () const |
| value_type | zx () const |
| value_type | zy () const |
| value_type | zz () const |
| value_type | px () const |
| value_type | py () const |
| value_type | pz () const |
| xyzVector< T > | xaxis () const |
| xyzVector< T > | yaxis () const |
| xyzVector< T > | zaxis () const |
| xyzVector< T > | point () const |
| xyzMatrix< T > | rotation_matrix () const |
| void | set_identity_rotation () |
| Mutators. More... | |
| void | set_identity_transform () |
| void | set_identity () |
| void | set_xaxis_rotation_deg (T angle) |
| void | set_yaxis_rotation_deg (T angle) |
| void | set_zaxis_rotation_deg (T angle) |
| void | set_xaxis_rotation_rad (T angle) |
| void | set_yaxis_rotation_rad (T angle) |
| void | set_zaxis_rotation_rad (T angle) |
| void | set_transform (xyzVector< T > const &t) |
| Set this HT to describe a transformation along the three axes. This has the size effect of setting the axes to the global axes. More... | |
| void | set_point (xyzVector< T > const &p) |
| Set the point that this HT is centered at. This leaves the axes untouched. More... | |
| void | walk_along_x (T delta) |
| Right multiply this coordinate frame by the frame 1 0 0 delta 0 1 0 0 0 0 1 0. More... | |
| void | walk_along_y (T delta) |
| Right multiply this coordinate frame by the frame 1 0 0 0 0 1 0 delta 0 0 1 0. More... | |
| void | walk_along_z (T delta) |
| Right multiply this coordinate frame by the frame 1 0 0 0 0 1 0 0 0 0 1 delta. More... | |
| HomogeneousTransform< T > | operator* (HomogeneousTransform< T > const &rmat) const |
| Multiplication. More... | |
| xyzVector< T > | operator* (xyzVector< T > const &vect) const |
| Transform a point. The input point is a location in this coordinate frame the output point is the location in global coordinate frame. More... | |
| HomogeneousTransform< T > | inverse () const |
| Invert this matrix. More... | |
| xyzVector< T > | to_local_coordinate (xyzVector< T > const &v) const |
| Convert a point in the global coordinate system to a point in this coordinate frame. If this frame is F and the point is p, then this solves for x st: F x = p. Equivalent to computing (F.inverse() * p).point(). More... | |
| xyzVector< T > | euler_angles_rad () const |
| Return the three euler angles (in radians) that describe this HomogeneousTransform as the series of a Z axis rotation by the angle phi (returned in position 1 of the output vector), followed by an X axis rotation by the angle theta (returned in position 3 of the output vector), followed by another Z axis rotation by the angle psi (returned in position 2 of the output vector). This code is a modified version of Alex Z's code from r++. More... | |
| xyzVector< T > | euler_angles_deg () const |
| void | from_euler_angles_rad (xyzVector< T > const &euler) |
| Construct the coordinate frame from three euler angles that describe the frame. Keep the point fixed. See the description for euler_angles_rad() to understand the Z-X-Z transformation convention. More... | |
| void | from_euler_angles_deg (xyzVector< T > const &euler) |
| T | xform_magnitude (T radius_of_gyration) |
| Less accurate functions. More... | |
| std::ostream & | show (std::ostream &stream=std::cout) const |
Private Member Functions | |
| bool | orthonormal () const |
| bool | orthoganol () const |
| Are the axis orthoganol. More... | |
| bool | normal () const |
| Are the axis of unit length? More... | |
Private Attributes | |
| value_type | xx_ |
| For axis Q, the R component is named qr_; e.g. The Z component of the Y axis is yz_;. More... | |
| value_type | yx_ |
| value_type | zx_ |
| value_type | px_ |
| value_type | xy_ |
| value_type | yy_ |
| value_type | zy_ |
| value_type | py_ |
| value_type | xz_ |
| value_type | yz_ |
| value_type | zz_ |
| value_type | pz_ |
| typedef T numeric::HomogeneousTransform< T >::value_type |
|
inline |
Default constructor: axis aligned with the global coordinate frame and the point located at the origin.
|
inline |
Construct the coordinate frame from the points defined such that.
|
inline |
Constructor from xyzVectors: trust that the axis are indeed orthoganol.
|
inline |
|
inline |
|
inline |
Return the three euler angles (in radians) that describe this HomogeneousTransform as the series of a Z axis rotation by the angle phi (returned in position 1 of the output vector), followed by an X axis rotation by the angle theta (returned in position 3 of the output vector), followed by another Z axis rotation by the angle psi (returned in position 2 of the output vector). This code is a modified version of Alex Z's code from r++.
The range of phi is [ -pi, pi ]; The range of psi is [ -pi, pi ]; The range of theta is [ 0, pi ];
The function pretends that this HomogeneousTransform is the result of these three transformations; if it were, then the rotation matrix 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) ]
where each axis above is represented as a ROW VECTOR (to be distinguished from the HomogeneousTransform's representation of axes as COLUMN VECTORS).
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'))) . | .
| 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)
Referenced by numeric::HomogeneousTransform< double >::euler_angles_deg().
|
inline |
|
inline |
Construct the coordinate frame from three euler angles that describe the frame. Keep the point fixed. See the description for euler_angles_rad() to understand the Z-X-Z transformation convention.
Referenced by numeric::HomogeneousTransform< double >::from_euler_angles_deg().
|
inline |
Invert this matrix.
|
inlineprivate |
Are the axis of unit length?
Referenced by numeric::HomogeneousTransform< double >::orthonormal().
|
inline |
Multiplication.
the main operation of a homogeneous transform: matrix multiplication. Note: matrix multiplication is transitive, so rotation/translation matrices may be pre-multiplied before being applied to a set of points.
|
inline |
Transform a point. The input point is a location in this coordinate frame the output point is the location in global coordinate frame.
|
inlineprivate |
Are the axis orthoganol.
Referenced by numeric::HomogeneousTransform< double >::orthonormal().
|
inlineprivate |
|
inline |
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
|
inline |
|
inline |
Mutators.
Referenced by numeric::HomogeneousTransform< double >::set_identity(), and numeric::HomogeneousTransform< double >::set_transform().
|
inline |
Referenced by numeric::HomogeneousTransform< double >::set_identity().
|
inline |
Set the point that this HT is centered at. This leaves the axes untouched.
|
inline |
Set this HT to describe a transformation along the three axes. This has the size effect of setting the axes to the global axes.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by pyrosetta.distributed.viewer.core.Viewer::__call__().
|
inline |
Convert a point in the global coordinate system to a point in this coordinate frame. If this frame is F and the point is p, then this solves for x st: F x = p. Equivalent to computing (F.inverse() * p).point().
|
inline |
Right multiply this coordinate frame by the frame 1 0 0 delta 0 1 0 0 0 0 1 0.
|
inline |
Right multiply this coordinate frame by the frame 1 0 0 0 0 1 0 delta 0 0 1 0.
|
inline |
Right multiply this coordinate frame by the frame 1 0 0 0 0 1 0 0 0 0 1 delta.
|
inline |
|
inline |
Less accurate functions.
Used to calculate no-alignment "RMSD" of two identical poses using transforms
For this to work, the two poses must be identical, but with different orientations. Here are the steps to use this:
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
inline |
Referenced by numeric::HomogeneousTransform< double >::show().
|
private |
Referenced by numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::point(), numeric::HomogeneousTransform< double >::px(), numeric::HomogeneousTransform< double >::set_identity_transform(), numeric::HomogeneousTransform< double >::set_point(), numeric::HomogeneousTransform< double >::set_transform(), numeric::HomogeneousTransform< double >::walk_along_x(), numeric::HomogeneousTransform< double >::walk_along_y(), numeric::HomogeneousTransform< double >::walk_along_z(), and numeric::HomogeneousTransform< double >::xform_magnitude().
|
private |
Referenced by numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::point(), numeric::HomogeneousTransform< double >::py(), numeric::HomogeneousTransform< double >::set_identity_transform(), numeric::HomogeneousTransform< double >::set_point(), numeric::HomogeneousTransform< double >::set_transform(), numeric::HomogeneousTransform< double >::walk_along_x(), numeric::HomogeneousTransform< double >::walk_along_y(), numeric::HomogeneousTransform< double >::walk_along_z(), and numeric::HomogeneousTransform< double >::xform_magnitude().
|
private |
Referenced by numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::point(), numeric::HomogeneousTransform< double >::pz(), numeric::HomogeneousTransform< double >::set_identity_transform(), numeric::HomogeneousTransform< double >::set_point(), numeric::HomogeneousTransform< double >::set_transform(), numeric::HomogeneousTransform< double >::walk_along_x(), numeric::HomogeneousTransform< double >::walk_along_y(), numeric::HomogeneousTransform< double >::walk_along_z(), and numeric::HomogeneousTransform< double >::xform_magnitude().
|
private |
For axis Q, the R component is named qr_; e.g. The Z component of the Y axis is yz_;.
Variables below are allocated in an intentionally visually pleasing order for a code reader, not necessarily for performance. The homogenous matrix is a 4 x 3 matrix, with a pseudo row-major ordering of data. Naming scheme: Column 1 is the x axis as a column vector Column 2 is the y axis as a column vector Column 3 is the z axis as a column vector Column 4 is the location of the point, as a column vector. Row 1 is the x coordinate of the three axes and the point Row 2 is the y coordinate of the three axes and the point Row 3 is the z coordinate of the three axes and the point Row 4 is not explicitly represented, but is always [ 0, 0, 0, 1 ]Note: This naming scheme is different from the one that Stuart uses in the xyzMatrix class.
Referenced by numeric::HomogeneousTransform< double >::euler_angles_rad(), numeric::HomogeneousTransform< double >::from_euler_angles_rad(), numeric::HomogeneousTransform< double >::HomogeneousTransform(), numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::normal(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::orthoganol(), numeric::HomogeneousTransform< double >::rotation_matrix(), numeric::HomogeneousTransform< double >::set_identity_rotation(), numeric::HomogeneousTransform< double >::walk_along_x(), numeric::HomogeneousTransform< double >::xaxis(), numeric::HomogeneousTransform< double >::xform_magnitude(), and numeric::HomogeneousTransform< double >::xx().
|
private |
Referenced by numeric::HomogeneousTransform< double >::from_euler_angles_rad(), numeric::HomogeneousTransform< double >::HomogeneousTransform(), numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::normal(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::orthoganol(), numeric::HomogeneousTransform< double >::rotation_matrix(), numeric::HomogeneousTransform< double >::set_identity_rotation(), numeric::HomogeneousTransform< double >::walk_along_x(), numeric::HomogeneousTransform< double >::xaxis(), and numeric::HomogeneousTransform< double >::xy().
|
private |
Referenced by numeric::HomogeneousTransform< double >::euler_angles_rad(), numeric::HomogeneousTransform< double >::from_euler_angles_rad(), numeric::HomogeneousTransform< double >::HomogeneousTransform(), numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::normal(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::orthoganol(), numeric::HomogeneousTransform< double >::rotation_matrix(), numeric::HomogeneousTransform< double >::set_identity_rotation(), numeric::HomogeneousTransform< double >::walk_along_x(), numeric::HomogeneousTransform< double >::xaxis(), and numeric::HomogeneousTransform< double >::xz().
|
private |
Referenced by numeric::HomogeneousTransform< double >::euler_angles_rad(), numeric::HomogeneousTransform< double >::from_euler_angles_rad(), numeric::HomogeneousTransform< double >::HomogeneousTransform(), numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::normal(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::orthoganol(), numeric::HomogeneousTransform< double >::rotation_matrix(), numeric::HomogeneousTransform< double >::set_identity_rotation(), numeric::HomogeneousTransform< double >::walk_along_y(), numeric::HomogeneousTransform< double >::yaxis(), and numeric::HomogeneousTransform< double >::yx().
|
private |
Referenced by numeric::HomogeneousTransform< double >::from_euler_angles_rad(), numeric::HomogeneousTransform< double >::HomogeneousTransform(), numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::normal(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::orthoganol(), numeric::HomogeneousTransform< double >::rotation_matrix(), numeric::HomogeneousTransform< double >::set_identity_rotation(), numeric::HomogeneousTransform< double >::walk_along_y(), numeric::HomogeneousTransform< double >::xform_magnitude(), numeric::HomogeneousTransform< double >::yaxis(), and numeric::HomogeneousTransform< double >::yy().
|
private |
Referenced by numeric::HomogeneousTransform< double >::euler_angles_rad(), numeric::HomogeneousTransform< double >::from_euler_angles_rad(), numeric::HomogeneousTransform< double >::HomogeneousTransform(), numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::normal(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::orthoganol(), numeric::HomogeneousTransform< double >::rotation_matrix(), numeric::HomogeneousTransform< double >::set_identity_rotation(), numeric::HomogeneousTransform< double >::walk_along_y(), numeric::HomogeneousTransform< double >::yaxis(), and numeric::HomogeneousTransform< double >::yz().
|
private |
Referenced by numeric::HomogeneousTransform< double >::euler_angles_rad(), numeric::HomogeneousTransform< double >::from_euler_angles_rad(), numeric::HomogeneousTransform< double >::HomogeneousTransform(), numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::normal(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::orthoganol(), numeric::HomogeneousTransform< double >::rotation_matrix(), numeric::HomogeneousTransform< double >::set_identity_rotation(), numeric::HomogeneousTransform< double >::walk_along_z(), numeric::HomogeneousTransform< double >::zaxis(), and numeric::HomogeneousTransform< double >::zx().
|
private |
Referenced by numeric::HomogeneousTransform< double >::euler_angles_rad(), numeric::HomogeneousTransform< double >::from_euler_angles_rad(), numeric::HomogeneousTransform< double >::HomogeneousTransform(), numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::normal(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::orthoganol(), numeric::HomogeneousTransform< double >::rotation_matrix(), numeric::HomogeneousTransform< double >::set_identity_rotation(), numeric::HomogeneousTransform< double >::walk_along_z(), numeric::HomogeneousTransform< double >::zaxis(), and numeric::HomogeneousTransform< double >::zy().
|
private |
Referenced by numeric::HomogeneousTransform< double >::euler_angles_rad(), numeric::HomogeneousTransform< double >::from_euler_angles_rad(), numeric::HomogeneousTransform< double >::HomogeneousTransform(), numeric::HomogeneousTransform< double >::inverse(), numeric::HomogeneousTransform< double >::normal(), numeric::HomogeneousTransform< double >::operator*(), numeric::HomogeneousTransform< double >::orthoganol(), numeric::HomogeneousTransform< double >::rotation_matrix(), numeric::HomogeneousTransform< double >::set_identity_rotation(), numeric::HomogeneousTransform< double >::walk_along_z(), numeric::HomogeneousTransform< double >::xform_magnitude(), numeric::HomogeneousTransform< double >::zaxis(), and numeric::HomogeneousTransform< double >::zz().
1.8.7