Celeritas  0.5.0-86+4a8eea4
Public Member Functions | List of all members
celeritas::TransformSimplifier Class Reference

Return a simplified version of a transformation. More...

#include <TransformSimplifier.hh>

Public Member Functions

 TransformSimplifier (Tolerance<> const &tol)
 Construct with tolerance.
 
VariantTransform operator() (NoTransformation const &nt)
 No simplification can be applied to a null transformation.
 
VariantTransform operator() (Translation const &nt)
 Translation may simplify to no transformation.
 
VariantTransform operator() (Transformation const &nt)
 Simplify, possibly to translation or no transform. More...
 

Detailed Description

Return a simplified version of a transformation.

Like surface simplification, we want to consider whether two different transformations will result in a distance change of \(\epsilon\) for a point that's at the length scale from the origin. Setting the length scale to unity (the default), we use the relative tolerance.

A translation can be deleted if its magnitude is less than epsilon.

For a translation, we use the fact that the trace (sum of diagonal elements) of any proper (non-reflecting) rotation matrix has an angle of rotation

\[ \mathrm{Tr}[R] = 2 \cos \theta + 1 \]

about an axis of rotation. Applying the rotation to a point at a unit distance will yield an iscoceles triangle with sides 1 and inner angle \(\theta\). For the displacement to be no more than \(\epsilon\) then the angle must be

\[ \sin \theta/2 \le \epsilon/2 \]

which with some manipulation means that a "soft zero" rotation has a trace

\[ \mathrm{Tr}[R] \ge 3 - \epsilon^2 \,. \]

Note that this means no rotational simplifications may be performed when the geometry tolerance is less than the square root of machine precision.

Member Function Documentation

◆ operator()()

VariantTransform celeritas::TransformSimplifier::operator() ( Transformation const &  t)

Simplify, possibly to translation or no transform.

See the derivation in the class documentation.


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