|
Celeritas 0.7.0-dev.169+develop.bdc0041f6
|
Apply transformations with rotation and/or reflection. More...
#include <Transformation.hh>
Classes | |
| struct | Properties |
| Calculated properties about the transformation. More... | |
Type aliases | |
| using | StorageSpan = Span< real_type const, 12 > |
| Transformation type identifier. | |
| using | Mat3 = SquareMatrixReal3 |
| Transformation type identifier. | |
| static CELER_CONSTEXPR_FUNCTION TransformType | transform_type () |
| Transformation type identifier. | |
| static Transformation | from_inverse (Mat3 const &rot, Real3 const &trans) |
| Construct by inverting another transformation. | |
| Transformation (Mat3 const &rot, Real3 const &trans) | |
| Construct with rotation and translation. | |
| Transformation () | |
| Construct as an identity transform. | |
| Transformation (Translation const &) | |
| Promote from a translation. | |
| Transformation (SignedPermutation const &) | |
| Transformation type identifier. | |
| CELER_FUNCTION | Transformation (StorageSpan) |
| Construct inline from storage. | |
| CELER_FORCEINLINE_FUNCTION Mat3 const & | rotation () const |
| Rotation matrix. | |
| CELER_FORCEINLINE_FUNCTION Real3 const & | translation () const |
| Translation vector. | |
| CELER_FUNCTION StorageSpan | data () const |
| Get a view to the data for type-deleted storage. | |
| CELER_FUNCTION Real3 | transform_up (Real3 const &pos) const |
| Transform from daughter to parent. | |
| CELER_FUNCTION Real3 | transform_down (Real3 const &parent_pos) const |
| Transform from parent to daughter. | |
| CELER_FUNCTION Real3 | rotate_up (Real3 const &dir) const |
| Rotate from daughter to parent. | |
| CELER_FUNCTION Real3 | rotate_down (Real3 const &parent_dir) const |
| Rotate from parent to daughter. | |
| Transformation | calc_inverse () const |
| Calculate the inverse during preprocessing. | |
| Properties | calc_properties () const |
| Calculate properties about the matrix. | |
Apply transformations with rotation and/or reflection.
This class enables transforms between daughter and parent coordinate system. The transfer from a daughter into a parent system ("up" in a hierarchy of universes) is
\[ \mathbf{r}_p = \mathbf{R}\mathbf{r}_d + \mathbf{t}\:, \]
Where the subscripts p,d refer to the parent and daughter coordinate systems, respectively. The vector t is a translation vector. To go from the parent into the daughter system ("down" in a universe hierarchy) we apply the inverse:
\[ \mathbf{r}_d = \mathbf{R}^T(\mathbf{r}_p - \mathbf{t})\:. \]
where the transpose of R is equal to its inverse because the matrix is unitary.
The rotation matrix is indexed with C ordering, [i][j]. If a rotation matrix, it should be a orthonormal with a determinant is 1 if not reflecting (proper) or -1 if reflecting (improper). A transformation that applies a scaling has non-unit eigenvalues.
It is the caller's job to ensure a user-provided low-precision rotation matrix is orthonormal: see celeritas::orthonormalize . (Add CELER_VALIDATE to the calling code if constructing a transformation matrix from user input or a suspect source.)
|
inline |
Transform from parent to daughter.
Subtract the translation, then apply the inverse of the rotation matrix (its transpose).
|
inline |
Transform from daughter to parent.
Apply the rotation matrix, add the translation.