Celeritas  0.5.0-86+4a8eea4
List of all members
celeritas::Transformation Class Reference

Apply transformations with rotation and/or reflection. More...

#include <Transformation.hh>

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 and check the input. More...
 
 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. More...
 
CELER_FUNCTION Real3 transform_down (Real3 const &parent_pos) const
 Transform from parent to daughter. More...
 
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.
 

Detailed Description

Apply transformations with rotation and/or reflection.

Note
The nomenclature in this class assumes the translation vector and rotation matrix given represent "daughter-to-parent"! This is because we think of rotations being with respect to the daughter's origin rather than the parent's.

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].

Constructor & Destructor Documentation

◆ Transformation()

celeritas::Transformation::Transformation ( Mat3 const &  rot,
Real3 const &  trans 
)

Construct and check the input.

The input rotation matrix should be an orthonormal matrix. Its determinant is 1 if not reflecting (proper) or -1 if reflecting (improper). It is the caller's job to ensure a user-provided low-precision 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.)

Member Function Documentation

◆ transform_down()

CELER_FUNCTION Real3 celeritas::Transformation::transform_down ( Real3 const &  pos) const
inline

Transform from parent to daughter.

Subtract the translation, then apply the inverse of the rotation matrix (its transpose).

◆ transform_up()

CELER_FUNCTION Real3 celeritas::Transformation::transform_up ( Real3 const &  pos) const
inline

Transform from daughter to parent.

Apply the rotation matrix, add the translation.


The documentation for this class was generated from the following files: