The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
RotateGeometryDecorator Class Reference

#include <RotateGeometryDecorator.hpp>

Inheritance diagram for RotateGeometryDecorator:
Inheritance graph
[legend]

Public Member Functions

double density (Position bfr) const override
 
double eulerAlpha () const
 
double eulerBeta () const
 
double eulerGamma () const
 
Position generatePosition () const override
 
Geometrygeometry () const
 
void setupSelfBefore () override
 
double SigmaX () const override
 
double SigmaY () const override
 
double SigmaZ () const override
 
- Public Member Functions inherited from GenGeometry
int dimension () const override
 
virtual double density (Position bfr) const =0
 
virtual int dimension () const =0
 
virtual Position generatePosition () const =0
 
virtual double SigmaX () const =0
 
virtual double SigmaY () const =0
 
virtual double SigmaZ () const =0
 
- Public Member Functions inherited from SimulationItem
template<class T >
T * find (bool setup=true) const
 
template<class T >
T * interface (int levels=-999999, bool setup=true) const
 
virtual string itemName () const
 
void setup ()
 
string typeAndName () const
 
- Public Member Functions inherited from Item
 Item (const Item &)=delete
 
virtual ~Item ()
 
void addChild (Item *child)
 
const vector< Item * > & children () const
 
virtual void clearItemListProperty (const PropertyDef *property)
 
void destroyChild (Item *child)
 
virtual bool getBoolProperty (const PropertyDef *property) const
 
virtual vector< double > getDoubleListProperty (const PropertyDef *property) const
 
virtual double getDoubleProperty (const PropertyDef *property) const
 
virtual string getEnumProperty (const PropertyDef *property) const
 
virtual int getIntProperty (const PropertyDef *property) const
 
virtual vector< Item * > getItemListProperty (const PropertyDef *property) const
 
virtual ItemgetItemProperty (const PropertyDef *property) const
 
virtual string getStringProperty (const PropertyDef *property) const
 
int getUtilityProperty (string name) const
 
virtual void insertIntoItemListProperty (const PropertyDef *property, int index, Item *item)
 
Itemoperator= (const Item &)=delete
 
Itemparent () const
 
virtual void removeFromItemListProperty (const PropertyDef *property, int index)
 
virtual void setBoolProperty (const PropertyDef *property, bool value)
 
virtual void setDoubleListProperty (const PropertyDef *property, vector< double > value)
 
virtual void setDoubleProperty (const PropertyDef *property, double value)
 
virtual void setEnumProperty (const PropertyDef *property, string value)
 
virtual void setIntProperty (const PropertyDef *property, int value)
 
virtual void setItemProperty (const PropertyDef *property, Item *item)
 
virtual void setStringProperty (const PropertyDef *property, string value)
 
void setUtilityProperty (string name, int value)
 
virtual string type () const
 

Protected Member Functions

 RotateGeometryDecorator ()
 
- Protected Member Functions inherited from GenGeometry
 GenGeometry ()
 
- Protected Member Functions inherited from Geometry
 Geometry ()
 
Randomrandom () const
 
void setupSelfBefore () override
 
- Protected Member Functions inherited from SimulationItem
 SimulationItem ()
 
virtual bool offersInterface (const std::type_info &interfaceTypeInfo) const
 
virtual void setupSelfAfter ()
 
virtual void setupSelfBefore ()
 
- Protected Member Functions inherited from Item
 Item ()
 

Private Types

using BaseType = GenGeometry
 
using ItemType = RotateGeometryDecorator
 

Private Member Functions

Position derotate (Position bfr) const
 
Position rotate (Position bfrorig) const
 

Private Attributes

double _cosalpha
 
double _cosbeta
 
double _cosgamma
 
double _eulerAlpha
 
double _eulerBeta
 
double _eulerGamma
 
Geometry_geometry
 
double _R11
 
double _R12
 
double _R13
 
double _R21
 
double _R22
 
double _R23
 
double _R31
 
double _R32
 
double _R33
 
double _sinalpha
 
double _sinbeta
 
double _singamma
 

Friends

class ItemRegistry
 

Detailed Description

The RotateGeometryDecorator class is a decorator that applies an arbitrary rotation to any geometry. For the rotation, we use the general framework of the three Euler angles that can be used to decompose any rotation into a sequence of three individual rotations over the principle axes. We apply the following set of rotations (the so-called X-convention):

If the original position of a vector is denoted as \({\bf{r}}_{\text{orig}}\), the new position can be found as \({\bf{r}} = {\bf{R}}\,{\bf{r}}_{\text{orig}}\), where the rotation matrix \({\bf{R}}\) is given by

\[ {\bf{R}} = \begin{pmatrix} \cos\gamma & \sin\gamma & 0 \\ -\sin\gamma & \cos\gamma & 0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos\beta & \sin\beta \\ 0 & -\sin\beta & \cos\beta \end{pmatrix} \begin{pmatrix} \cos\alpha & \sin\alpha & 0 \\ -\sin\alpha & \cos\alpha & 0 \\ 0 & 0 & 1 \end{pmatrix} \]

or explicitly

\[ {\bf{R}} = \begin{pmatrix} \cos\alpha\cos\gamma-\sin\alpha\cos\beta\sin\gamma & \cos\gamma\sin\alpha+\cos\alpha\cos\beta\sin\gamma & \sin\beta\sin\gamma \\ -\cos\alpha\sin\gamma-\sin\alpha\cos\beta\cos\gamma & -\sin\alpha\sin\gamma+\cos\alpha\cos\beta\cos\gamma & \sin\beta\cos\gamma \\ \sin\alpha\sin\beta & -\cos\alpha\sin\beta & \cos\beta \end{pmatrix} \]

The properties of a RotateGeometryDecorator object are a reference to the Geometry object being decorated, and the three Euler angles \((\alpha,\beta,\gamma)\) that describe the rotation. The resulting geometry is identical to the geometry being decorated, except that the density distribution is rotated over the three Euler angles.

Constructor & Destructor Documentation

◆ RotateGeometryDecorator()

RotateGeometryDecorator::RotateGeometryDecorator ( )
inlineprotected

Default constructor for concrete Item subclass RotateGeometryDecorator : "a decorator that adds a rotation to any geometry" .

Member Function Documentation

◆ density()

double RotateGeometryDecorator::density ( Position  bfr) const
overridevirtual

This function returns the density \(\rho({\bf{r}})\) at the position \({\bf{r}}\). It calls the density() function for the geometry being decorated with the derotated position \({\bf{r}}_{\text{orig}} = {\bf{R}}^{\text{T}}\,{\bf{r}}\) as the argument.

Implements Geometry.

◆ derotate()

Position RotateGeometryDecorator::derotate ( Position  bfr) const
private

This function derotates a position \({\bf{r}}\), i.e. it returns the derotated position vector \({\bf{r}}_{\text{orig}} = {\bf{R}}^{\text{T}}\,{\bf{r}}\).

◆ eulerAlpha()

RotateGeometryDecorator::eulerAlpha ( ) const
inline

This function returns the value of the discoverable double property eulerAlpha : "the first Euler angle α" .

This property represents a physical quantity of type "posangle" .

The minimum value for this property is "0 deg" .

The maximum value for this property is "360 deg" .

The default value for this property is given by the conditional value expression "0 deg" .

◆ eulerBeta()

RotateGeometryDecorator::eulerBeta ( ) const
inline

This function returns the value of the discoverable double property eulerBeta : "the second Euler angle β" .

This property represents a physical quantity of type "posangle" .

The minimum value for this property is "0 deg" .

The maximum value for this property is "180 deg" .

The default value for this property is given by the conditional value expression "0 deg" .

◆ eulerGamma()

RotateGeometryDecorator::eulerGamma ( ) const
inline

This function returns the value of the discoverable double property eulerGamma : "the third Euler angle γ" .

This property represents a physical quantity of type "posangle" .

The minimum value for this property is "0 deg" .

The maximum value for this property is "360 deg" .

The default value for this property is given by the conditional value expression "0 deg" .

◆ generatePosition()

Position RotateGeometryDecorator::generatePosition ( ) const
overridevirtual

This function generates a random position from the geometry, by drawing a random point from the three-dimensional probability density \(p({\bf{r}})\, {\text{d}}{\bf{r}} = \rho({\bf{r}})\, {\text{d}}{\bf{r}}\). It calls the density() function for the geometry being decorated and rotates the resulting position \({\bf{r}}_{\text{orig}}\).

Implements Geometry.

◆ geometry()

Geometry * RotateGeometryDecorator::geometry ( ) const
inline

This function returns the value of the discoverable item property geometry : "the geometry to be rotated" .

◆ rotate()

Position RotateGeometryDecorator::rotate ( Position  bfrorig) const
private

This function rotates a position \({\bf{r}}_{\text{orig}}\), i.e. it returns the rotated position vector \({\bf{r}} = {\bf{R}}\,{\bf{r}}_{\text{orig}}\).

◆ setupSelfBefore()

void RotateGeometryDecorator::setupSelfBefore ( )
overridevirtual

This function calculates and stores some auxiliary values.

Reimplemented from Geometry.

◆ SigmaX()

double RotateGeometryDecorator::SigmaX ( ) const
overridevirtual

This function returns the X-axis surface density, i.e. the integration of the density along the entire X-axis,

\[ \Sigma_X = \int_{-\infty}^\infty \rho(x,0,0)\,{\text{d}}x. \]

It is impossible to calculate this value for a random value of the rotation angles. We simply return the X-axis surface density of the original geometry.

Implements Geometry.

◆ SigmaY()

double RotateGeometryDecorator::SigmaY ( ) const
overridevirtual

This function returns the Y-axis surface density, i.e. the integration of the density along the entire Y-axis,

\[ \Sigma_Y = \int_{-\infty}^\infty \rho(0,y,0)\,{\text{d}}y. \]

It is impossible to calculate this value for a random value of the rotation angles. We simply return the Y-axis surface density of the original geometry.

Implements Geometry.

◆ SigmaZ()

double RotateGeometryDecorator::SigmaZ ( ) const
overridevirtual

This function returns the Z-axis surface density, i.e. the integration of the density along the entire Z-axis,

\[ \Sigma_Z = \int_{-\infty}^\infty \rho(0,0,z)\,{\text{d}}z. \]

It is impossible to calculate this value for a random value of the rotation angles. We simply return the Z-axis surface density of the original geometry.

Implements Geometry.


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