Logo ROOT  
Reference Guide
ROOT::Math::Rotation3D Class Reference

Rotation class with the (3D) rotation represented by a 3x3 orthogonal matrix.

This is the optimal representation for application to vectors. See also ROOT::Math::AxisAngle, ROOT::Math::EulerAngles, and ROOT::Math::Quaternion for classes which have conversion operators to Rotation3D.

All Rotations types (not only Rotation3D) can be applied to all 3D Vector classes (like ROOT::Math::DisplacementVector3D and ROOT::Math::PositionVector3D) and also to the 4D Vectors (ROOT::Math::LorentzVector classes), acting on the 3D components. A rotation operation is applied by using the operator() or the operator *. With the operator * is possible also to combine rotations. Note that the operator is NOT commutative, the order how the rotations are applied is relevant.

Definition at line 65 of file Rotation3D.h.

Public Types

enum  ERotation3DMatrixIndex {
  kXX = 0 , kXY = 1 , kXZ = 2 , kYX = 3 ,
  kYY = 4 , kYZ = 5 , kZX = 6 , kZY = 7 ,
  kZZ = 8
}
 
typedef double Scalar
 

Public Member Functions

 Rotation3D ()
 Default constructor (identity rotation) More...
 
 Rotation3D (AxisAngle const &a)
 Construct from an AxisAngle. More...
 
template<class ForeignMatrix >
 Rotation3D (const ForeignMatrix &m)
 Construct from a linear algebra matrix of size at least 3x3, which must support operator()(i,j) to obtain elements (0,0) thru (2,2). More...
 
template<class ForeignVector >
 Rotation3D (const ForeignVector &v1, const ForeignVector &v2, const ForeignVector &v3)
 Construct from three orthonormal vectors (which must have methods x(), y() and z()) which will be used as the columns of the rotation matrix. More...
 
 Rotation3D (EulerAngles const &e)
 Construct from EulerAngles. More...
 
template<class IT >
 Rotation3D (IT begin, IT end)
 Construct given a pair of pointers or iterators defining the beginning and end of an array of nine Scalars. More...
 
 Rotation3D (Quaternion const &q)
 Construct from a Quaternion. More...
 
 Rotation3D (Rotation3D const &r)
 copy constructor More...
 
 Rotation3D (RotationX const &r)
 
 Rotation3D (RotationY const &r)
 
 Rotation3D (RotationZ const &r)
 Construct from an axial rotation. More...
 
 Rotation3D (RotationZYX const &e)
 Construct from RotationZYX. More...
 
 Rotation3D (Scalar xx, Scalar xy, Scalar xz, Scalar yx, Scalar yy, Scalar yz, Scalar zx, Scalar zy, Scalar zz)
 Raw constructor from nine Scalar components (without any checking) More...
 
template<class ForeignVector >
void GetComponents (ForeignVector &v1, ForeignVector &v2, ForeignVector &v3) const
 Get components into three vectors which will be the (orthonormal) columns of the rotation matrix. More...
 
template<class IT >
void GetComponents (IT begin) const
 Get the 9 matrix components into data specified by an iterator begin. More...
 
template<class IT >
void GetComponents (IT begin, IT end) const
 Get the 9 matrix components into data specified by an iterator begin and another to the end of the desired data (9 past start). More...
 
void GetComponents (Scalar &xx, Scalar &xy, Scalar &xz, Scalar &yx, Scalar &yy, Scalar &yz, Scalar &zx, Scalar &zy, Scalar &zz) const
 Get the nine components into nine scalars. More...
 
template<class ForeignMatrix >
void GetRotationMatrix (ForeignMatrix &m) const
 Get components into a linear algebra matrix of size at least 3x3, which must support operator()(i,j) for write access to elements (0,0) thru (2,2). More...
 
Rotation3D Inverse () const
 Return inverse of a rotation. More...
 
void Invert ()
 Invert a rotation in place. More...
 
bool operator!= (const Rotation3D &rhs) const
 
template<class CoordSystem , class U >
DisplacementVector3D< CoordSystem, U > operator() (const DisplacementVector3D< CoordSystem, U > &v) const
 Rotation operation on a displacement vector in any coordinate system. More...
 
template<class ForeignVector >
ForeignVector operator() (const ForeignVector &v) const
 Rotation operation on an arbitrary vector v. More...
 
template<class CoordSystem >
LorentzVector< CoordSystem > operator() (const LorentzVector< CoordSystem > &v) const
 Rotation operation on a Lorentz vector in any spatial coordinate system. More...
 
template<class CoordSystem , class U >
PositionVector3D< CoordSystem, U > operator() (const PositionVector3D< CoordSystem, U > &v) const
 Rotation operation on a position vector in any coordinate system. More...
 
template<class AVector >
AVector operator* (const AVector &v) const
 Overload operator * for rotation on a vector. More...
 
Rotation3D operator* (const AxisAngle &a) const
 Multiplication with arbitrary rotations. More...
 
Rotation3D operator* (const EulerAngles &e) const
 
Rotation3D operator* (const Quaternion &q) const
 
Rotation3D operator* (const Rotation3D &r) const
 Multiply (combine) two rotations. More...
 
Rotation3D operator* (const RotationX &rx) const
 
Rotation3D operator* (const RotationY &ry) const
 
Rotation3D operator* (const RotationZ &rz) const
 
Rotation3D operator* (const RotationZYX &r) const
 
template<class R >
Rotation3Doperator*= (const R &r)
 Post-Multiply (on right) by another rotation : T = T*R. More...
 
Rotation3Doperator= (AxisAngle const &a)
 Assign from an AxisAngle. More...
 
template<class ForeignMatrix >
Rotation3Doperator= (const ForeignMatrix &m)
 Assign from an orthonormal linear algebra matrix of size 3x3, which must support operator()(i,j) to obtain elements (0,0) thru (2,2). More...
 
Rotation3Doperator= (EulerAngles const &e)
 Assign from EulerAngles. More...
 
Rotation3Doperator= (Quaternion const &q)
 Assign from a Quaternion. More...
 
Rotation3Doperator= (Rotation3D const &rhs)
 Assignment operator. More...
 
Rotation3Doperator= (RotationX const &r)
 
Rotation3Doperator= (RotationY const &r)
 
Rotation3Doperator= (RotationZ const &r)
 Assign from an axial rotation. More...
 
Rotation3Doperator= (RotationZYX const &r)
 Assign from RotationZYX. More...
 
bool operator== (const Rotation3D &rhs) const
 Equality/inequality operators. More...
 
void Rectify ()
 Re-adjust components to eliminate small deviations from perfect orthonormality. More...
 
template<class ForeignVector >
void SetComponents (const ForeignVector &v1, const ForeignVector &v2, const ForeignVector &v3)
 Set components from three orthonormal vectors (which must have methods x(), y() and z()) which will be used as the columns of the rotation matrix. More...
 
template<class IT >
void SetComponents (IT begin, IT end)
 Set the 9 matrix components given an iterator to the start of the desired data, and another to the end (9 past start). More...
 
void SetComponents (Scalar xx, Scalar xy, Scalar xz, Scalar yx, Scalar yy, Scalar yz, Scalar zx, Scalar zy, Scalar zz)
 Set the components from nine scalars – UNCHECKED for orthonormaility. More...
 
template<class ForeignMatrix >
void SetRotationMatrix (const ForeignMatrix &m)
 Set components from a linear algebra matrix of size at least 3x3, which must support operator()(i,j) to obtain elements (0,0) thru (2,2). More...
 

Private Attributes

Scalar fM [9]
 

#include <Math/GenVector/Rotation3D.h>

Member Typedef Documentation

◆ Scalar

Definition at line 69 of file Rotation3D.h.

Member Enumeration Documentation

◆ ERotation3DMatrixIndex

Enumerator
kXX 
kXY 
kXZ 
kYX 
kYY 
kYZ 
kZX 
kZY 
kZZ 

Definition at line 71 of file Rotation3D.h.

Constructor & Destructor Documentation

◆ Rotation3D() [1/13]

ROOT::Math::Rotation3D::Rotation3D ( )

Default constructor (identity rotation)

Definition at line 29 of file Rotation3D.cxx.

◆ Rotation3D() [2/13]

template<class IT >
ROOT::Math::Rotation3D::Rotation3D ( IT  begin,
IT  end 
)
inline

Construct given a pair of pointers or iterators defining the beginning and end of an array of nine Scalars.

Definition at line 89 of file Rotation3D.h.

◆ Rotation3D() [3/13]

ROOT::Math::Rotation3D::Rotation3D ( Rotation3D const &  r)
inline

copy constructor

Definition at line 94 of file Rotation3D.h.

◆ Rotation3D() [4/13]

ROOT::Math::Rotation3D::Rotation3D ( AxisAngle const &  a)
inlineexplicit

Construct from an AxisAngle.

Definition at line 101 of file Rotation3D.h.

◆ Rotation3D() [5/13]

ROOT::Math::Rotation3D::Rotation3D ( EulerAngles const &  e)
inlineexplicit

Construct from EulerAngles.

Definition at line 106 of file Rotation3D.h.

◆ Rotation3D() [6/13]

ROOT::Math::Rotation3D::Rotation3D ( RotationZYX const &  e)
inlineexplicit

Construct from RotationZYX.

Definition at line 111 of file Rotation3D.h.

◆ Rotation3D() [7/13]

ROOT::Math::Rotation3D::Rotation3D ( Quaternion const &  q)
inlineexplicit

Construct from a Quaternion.

Definition at line 116 of file Rotation3D.h.

◆ Rotation3D() [8/13]

ROOT::Math::Rotation3D::Rotation3D ( RotationZ const &  r)
inlineexplicit

Construct from an axial rotation.

Definition at line 121 of file Rotation3D.h.

◆ Rotation3D() [9/13]

ROOT::Math::Rotation3D::Rotation3D ( RotationY const &  r)
inlineexplicit

Definition at line 122 of file Rotation3D.h.

◆ Rotation3D() [10/13]

ROOT::Math::Rotation3D::Rotation3D ( RotationX const &  r)
inlineexplicit

Definition at line 123 of file Rotation3D.h.

◆ Rotation3D() [11/13]

template<class ForeignMatrix >
ROOT::Math::Rotation3D::Rotation3D ( const ForeignMatrix &  m)
inlineexplicit

Construct from a linear algebra matrix of size at least 3x3, which must support operator()(i,j) to obtain elements (0,0) thru (2,2).

Precondition: The matrix is assumed to be orthonormal. No checking or re-adjusting is performed.

Definition at line 132 of file Rotation3D.h.

◆ Rotation3D() [12/13]

template<class ForeignVector >
ROOT::Math::Rotation3D::Rotation3D ( const ForeignVector &  v1,
const ForeignVector &  v2,
const ForeignVector &  v3 
)
inline

Construct from three orthonormal vectors (which must have methods x(), y() and z()) which will be used as the columns of the rotation matrix.

The orthonormality will be checked, and values adjusted so that the result will always be a good rotation matrix.

Definition at line 141 of file Rotation3D.h.

◆ Rotation3D() [13/13]

ROOT::Math::Rotation3D::Rotation3D ( Scalar  xx,
Scalar  xy,
Scalar  xz,
Scalar  yx,
Scalar  yy,
Scalar  yz,
Scalar  zx,
Scalar  zy,
Scalar  zz 
)
inline

Raw constructor from nine Scalar components (without any checking)

Definition at line 150 of file Rotation3D.h.

Member Function Documentation

◆ GetComponents() [1/4]

template<class ForeignVector >
void ROOT::Math::Rotation3D::GetComponents ( ForeignVector &  v1,
ForeignVector &  v2,
ForeignVector &  v3 
) const
inline

Get components into three vectors which will be the (orthonormal) columns of the rotation matrix.

(The vector class must have a constructor from 3 Scalars.)

Definition at line 249 of file Rotation3D.h.

◆ GetComponents() [2/4]

template<class IT >
void ROOT::Math::Rotation3D::GetComponents ( IT  begin) const
inline

Get the 9 matrix components into data specified by an iterator begin.

Definition at line 289 of file Rotation3D.h.

◆ GetComponents() [3/4]

template<class IT >
void ROOT::Math::Rotation3D::GetComponents ( IT  begin,
IT  end 
) const
inline

Get the 9 matrix components into data specified by an iterator begin and another to the end of the desired data (9 past start).

Definition at line 276 of file Rotation3D.h.

◆ GetComponents() [4/4]

void ROOT::Math::Rotation3D::GetComponents ( Scalar xx,
Scalar xy,
Scalar xz,
Scalar yx,
Scalar yy,
Scalar yz,
Scalar zx,
Scalar zy,
Scalar zz 
) const
inline

Get the nine components into nine scalars.

Definition at line 336 of file Rotation3D.h.

◆ GetRotationMatrix()

template<class ForeignMatrix >
void ROOT::Math::Rotation3D::GetRotationMatrix ( ForeignMatrix &  m) const
inline

Get components into a linear algebra matrix of size at least 3x3, which must support operator()(i,j) for write access to elements (0,0) thru (2,2).

Definition at line 314 of file Rotation3D.h.

◆ Inverse()

Rotation3D ROOT::Math::Rotation3D::Inverse ( ) const
inline

Return inverse of a rotation.

Definition at line 414 of file Rotation3D.h.

◆ Invert()

void ROOT::Math::Rotation3D::Invert ( )

Invert a rotation in place.

Definition at line 109 of file Rotation3D.cxx.

◆ operator!=()

bool ROOT::Math::Rotation3D::operator!= ( const Rotation3D rhs) const
inline

Definition at line 472 of file Rotation3D.h.

◆ operator()() [1/4]

template<class CoordSystem , class U >
DisplacementVector3D< CoordSystem, U > ROOT::Math::Rotation3D::operator() ( const DisplacementVector3D< CoordSystem, U > &  v) const
inline

Rotation operation on a displacement vector in any coordinate system.

Definition at line 352 of file Rotation3D.h.

◆ operator()() [2/4]

template<class ForeignVector >
ForeignVector ROOT::Math::Rotation3D::operator() ( const ForeignVector &  v) const
inline

Rotation operation on an arbitrary vector v.

Preconditions: v must implement methods x(), y(), and z() and the arbitrary vector type must have a constructor taking (x,y,z)

Definition at line 390 of file Rotation3D.h.

◆ operator()() [3/4]

template<class CoordSystem >
LorentzVector< CoordSystem > ROOT::Math::Rotation3D::operator() ( const LorentzVector< CoordSystem > &  v) const
inline

Rotation operation on a Lorentz vector in any spatial coordinate system.

Definition at line 376 of file Rotation3D.h.

◆ operator()() [4/4]

template<class CoordSystem , class U >
PositionVector3D< CoordSystem, U > ROOT::Math::Rotation3D::operator() ( const PositionVector3D< CoordSystem, U > &  v) const
inline

Rotation operation on a position vector in any coordinate system.

Definition at line 365 of file Rotation3D.h.

◆ operator*() [1/9]

template<class AVector >
AVector ROOT::Math::Rotation3D::operator* ( const AVector &  v) const
inline

Overload operator * for rotation on a vector.

Definition at line 401 of file Rotation3D.h.

◆ operator*() [2/9]

Rotation3D ROOT::Math::Rotation3D::operator* ( const AxisAngle a) const

Multiplication with arbitrary rotations.

Definition at line 117 of file Rotation3D.cxx.

◆ operator*() [3/9]

Rotation3D ROOT::Math::Rotation3D::operator* ( const EulerAngles e) const

Definition at line 122 of file Rotation3D.cxx.

◆ operator*() [4/9]

Rotation3D ROOT::Math::Rotation3D::operator* ( const Quaternion q) const

Definition at line 127 of file Rotation3D.cxx.

◆ operator*() [5/9]

Rotation3D ROOT::Math::Rotation3D::operator* ( const Rotation3D r) const
inline

Multiply (combine) two rotations.

Definition at line 421 of file Rotation3D.h.

◆ operator*() [6/9]

Rotation3D ROOT::Math::Rotation3D::operator* ( const RotationX rx) const

Definition at line 14 of file Rotation3DxAxial.cxx.

◆ operator*() [7/9]

Rotation3D ROOT::Math::Rotation3D::operator* ( const RotationY ry) const

Definition at line 26 of file Rotation3DxAxial.cxx.

◆ operator*() [8/9]

Rotation3D ROOT::Math::Rotation3D::operator* ( const RotationZ rz) const

Definition at line 39 of file Rotation3DxAxial.cxx.

◆ operator*() [9/9]

Rotation3D ROOT::Math::Rotation3D::operator* ( const RotationZYX r) const

Definition at line 132 of file Rotation3D.cxx.

◆ operator*=()

template<class R >
Rotation3D & ROOT::Math::Rotation3D::operator*= ( const R r)
inline

Post-Multiply (on right) by another rotation : T = T*R.

Definition at line 455 of file Rotation3D.h.

◆ operator=() [1/9]

Rotation3D & ROOT::Math::Rotation3D::operator= ( AxisAngle const &  a)
inline

Assign from an AxisAngle.

Definition at line 174 of file Rotation3D.h.

◆ operator=() [2/9]

template<class ForeignMatrix >
Rotation3D & ROOT::Math::Rotation3D::operator= ( const ForeignMatrix &  m)
inline

Assign from an orthonormal linear algebra matrix of size 3x3, which must support operator()(i,j) to obtain elements (0,0) thru (2,2).

Definition at line 210 of file Rotation3D.h.

◆ operator=() [3/9]

Rotation3D & ROOT::Math::Rotation3D::operator= ( EulerAngles const &  e)
inline

Assign from EulerAngles.

Definition at line 180 of file Rotation3D.h.

◆ operator=() [4/9]

Rotation3D & ROOT::Math::Rotation3D::operator= ( Quaternion const &  q)
inline

Assign from a Quaternion.

Definition at line 192 of file Rotation3D.h.

◆ operator=() [5/9]

Rotation3D & ROOT::Math::Rotation3D::operator= ( Rotation3D const &  rhs)
inline

Assignment operator.

Definition at line 163 of file Rotation3D.h.

◆ operator=() [6/9]

Rotation3D & ROOT::Math::Rotation3D::operator= ( RotationX const &  r)
inline

Definition at line 202 of file Rotation3D.h.

◆ operator=() [7/9]

Rotation3D & ROOT::Math::Rotation3D::operator= ( RotationY const &  r)
inline

Definition at line 200 of file Rotation3D.h.

◆ operator=() [8/9]

Rotation3D & ROOT::Math::Rotation3D::operator= ( RotationZ const &  r)
inline

Assign from an axial rotation.

Definition at line 198 of file Rotation3D.h.

◆ operator=() [9/9]

Rotation3D & ROOT::Math::Rotation3D::operator= ( RotationZYX const &  r)
inline

Assign from RotationZYX.

Definition at line 186 of file Rotation3D.h.

◆ operator==()

bool ROOT::Math::Rotation3D::operator== ( const Rotation3D rhs) const
inline

Equality/inequality operators.

Definition at line 460 of file Rotation3D.h.

◆ Rectify()

void ROOT::Math::Rotation3D::Rectify ( )

Re-adjust components to eliminate small deviations from perfect orthonormality.

Definition at line 38 of file Rotation3D.cxx.

◆ SetComponents() [1/3]

template<class ForeignVector >
void ROOT::Math::Rotation3D::SetComponents ( const ForeignVector &  v1,
const ForeignVector &  v2,
const ForeignVector &  v3 
)
inline

Set components from three orthonormal vectors (which must have methods x(), y() and z()) which will be used as the columns of the rotation matrix.

The orthonormality will be checked, and values adjusted so that the result will always be a good rotation matrix.

Definition at line 233 of file Rotation3D.h.

◆ SetComponents() [2/3]

template<class IT >
void ROOT::Math::Rotation3D::SetComponents ( IT  begin,
IT  end 
)
inline

Set the 9 matrix components given an iterator to the start of the desired data, and another to the end (9 past start).

Definition at line 262 of file Rotation3D.h.

◆ SetComponents() [3/3]

void ROOT::Math::Rotation3D::SetComponents ( Scalar  xx,
Scalar  xy,
Scalar  xz,
Scalar  yx,
Scalar  yy,
Scalar  yz,
Scalar  zx,
Scalar  zy,
Scalar  zz 
)
inline

Set the components from nine scalars – UNCHECKED for orthonormaility.

Definition at line 324 of file Rotation3D.h.

◆ SetRotationMatrix()

template<class ForeignMatrix >
void ROOT::Math::Rotation3D::SetRotationMatrix ( const ForeignMatrix &  m)
inline

Set components from a linear algebra matrix of size at least 3x3, which must support operator()(i,j) to obtain elements (0,0) thru (2,2).

Precondition: The matrix is assumed to be orthonormal. NO checking or re-adjusting is performed.

Definition at line 301 of file Rotation3D.h.

Member Data Documentation

◆ fM

Scalar ROOT::Math::Rotation3D::fM[9]
private

Definition at line 478 of file Rotation3D.h.

Libraries for ROOT::Math::Rotation3D:
[legend]

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