EGSnrc C++ class library
Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
|
A class providing affine transformations. More...
#include <egs_transformations.h>
Public Member Functions | |
EGS_AffineTransform () | |
Constructs a unit affine transformation. | |
EGS_AffineTransform (const EGS_AffineTransform &tr) | |
Copy constructor. | |
EGS_AffineTransform (const EGS_RotationMatrix &m, const EGS_Vector &v) | |
Constructs an affine transformation object from the rotation m and translation v. | |
EGS_AffineTransform (const EGS_RotationMatrix &m) | |
Constructs an affine transformation object from the rotation m, which has no translation. | |
EGS_AffineTransform (const EGS_Vector &v) | |
Constructs an affine transformation object from the translation v, which has no rotation. | |
EGS_AffineTransform | operator* (const EGS_AffineTransform &tr) const |
Returns the multiplication of the invoking object with tr. More... | |
EGS_AffineTransform | operator* (const EGS_RotationMatrix &m) const |
Returns the affine transformation , where and are the rotation and translation of the invoking object. | |
EGS_AffineTransform & | operator*= (const EGS_AffineTransform &tr) |
Multiplies the invoking object from the right with tr. Returns a reference to the result. More... | |
EGS_AffineTransform & | operator*= (const EGS_RotationMatrix &m) |
Multiplies the invoking object from the right with m. Returns a reference to the result. More... | |
EGS_AffineTransform | operator+ (const EGS_Vector &v) const |
EGS_AffineTransform & | operator+= (const EGS_Vector &v) |
EGS_Vector | operator* (const EGS_Vector &v) const |
Applies the transformation to the vector v from the left and returns the result. | |
void | transform (EGS_Vector &v) const |
Transforms the vector v. | |
void | inverseTransform (EGS_Vector &v) const |
Applies the inverse transformation to the vector v. | |
EGS_AffineTransform | inverse () const |
Returns the inverse affine transformation. | |
void | rotate (EGS_Vector &v) const |
Applies the rotation to the vector v. | |
void | rotateInverse (EGS_Vector &v) const |
Applies the inverse rotation to the vector v. | |
void | translate (EGS_Vector &v) const |
Applies the translation to the vector v. | |
const EGS_Vector & | getTranslation () const |
Returns the translation vector of the affine transformation object. | |
const EGS_RotationMatrix & | getRotation () const |
Returns the rotation matrix of the affine transformation object. | |
bool | isI () const |
Returns true if the object is a unity transformation, false otherwise. | |
bool | hasTranslation () const |
Returns true if the transformation involves a translation, false otherwise. | |
bool | hasRotation () const |
Returns true if the transformation involves a rotation, false otherwise. | |
Static Public Member Functions | |
static EGS_AffineTransform * | getTransformation (EGS_Input *inp) |
Constructs an affine transformation object from the input pointed to by inp and returns a pointer to it. More... | |
Protected Attributes | |
EGS_RotationMatrix | R |
EGS_Vector | t |
bool | has_t |
bool | has_R |
Friends | |
EGS_Vector | operator* (const EGS_Vector &v, const EGS_AffineTransform &tr) |
Applies the transformation tr to the invoking vector from the right and returns the result. | |
EGS_Vector & | operator*= (EGS_Vector &v, const EGS_AffineTransform &tr) |
Applies the transformation tr to the invoking vector from the right, assignes the result to v and returns a reference to it. | |
A class providing affine transformations.
An affine transformation consists of a rotation and a translation , so that . See the getTransformation() documentation for description of the keys needed to define an affine transformation.
Definition at line 417 of file egs_transformations.h.
EGS_AffineTransform EGS_AffineTransform::operator* | ( | const EGS_AffineTransform & | tr | ) | const |
Returns the multiplication of the invoking object with tr.
The multiplication of 2 affine transformations and is defined as the affine transformation which, when applied on any vecor , results in the same vector that one would obtain by first transforming it with and then with . It is easy to see that and .
Definition at line 485 of file egs_transformations.h.
EGS_AffineTransform& EGS_AffineTransform::operator*= | ( | const EGS_AffineTransform & | tr | ) |
Multiplies the invoking object from the right with tr. Returns a reference to the result.
Definition at line 501 of file egs_transformations.h.
EGS_AffineTransform& EGS_AffineTransform::operator*= | ( | const EGS_RotationMatrix & | m | ) |
Multiplies the invoking object from the right with m. Returns a reference to the result.
Definition at line 510 of file egs_transformations.h.
|
static |
Constructs an affine transformation object from the input pointed to by inp and returns a pointer to it.
A transformation is defined in the input file using the following set of keys:
:start transformation: translation = tx, ty, tz rotation = 2, 3 or 9 floating point numbers or rotation vector = 3 floating point numbers :stop transformation:
There are many different ways to define a rotation. The rotation vector
input defines a rotation which, when applied to the 3D vector defined by the input, transforms it into a vector along the positive z-axis. For instance, if one wanted to have a rotation of +45 degrees around the y-axis, one would use -1,0,1 as input to the rotation vector
key. The input to the rotation
key is interpreted as follows:
Definition at line 43 of file egs_transformations.cpp.
References EGS_AffineTransform(), egsWarning, EGS_Input::getInput(), EGS_RotationMatrix::inverse(), EGS_Input::isA(), EGS_RotationMatrix::isRotation(), EGS_RotationMatrix::rotZ(), and EGS_Input::takeInputItem().
Referenced by EGS_BoxShape::createObject(), EGS_CylinderShape::createObject(), EGS_AEnvelope::createTransforms(), EGS_TransformedSource::EGS_TransformedSource(), EGS_GeometryTester::getGeometryTester(), and EGS_BaseShape::setTransformation().