WFMath_RotMatrix man page

WFMath::RotMatrix< dim > — A dim dimensional rotation matrix. Technically, a member of the group O(dim).

Synopsis

#include <rotmatrix.h>

Public Member Functions

RotMatrix & identity ()
set the matrix to the identity matrix
CoordType elem (const int i, const int j) const
get the (i, j) element of the matrix
bool setVals (const CoordType vals[dim][dim], CoordType precision=numeric_constants< CoordType >::epsilon())
Set the values of the elements of the matrix.
bool setVals (const CoordType vals[dim *dim], CoordType precision=numeric_constants< CoordType >::epsilon())
Set the values of the elements of the matrix.
Vector< dim > row (const int i) const
Get a copy of the i'th row as a Vector.
Vector< dim > column (const int i) const
Get a copy of the i'th column as a Vector.
CoordType trace () const
Get the trace of the matrix.
CoordType determinant () const
Get the determinant of the matrix.
RotMatrix inverse () const
Get the inverse of the matrix.
bool parity () const
Get the parity of the matrix.
RotMatrix & rotation (const int i, const int j, CoordType theta)
set the matrix to a rotation by the angle theta in the (i, j) plane
RotMatrix & rotation (const Vector< dim > &v1, const Vector< dim > &v2, CoordType theta)
set the matrix to a rotation by the angle theta in the v1, v2 plane
RotMatrix & rotation (const Vector< dim > &from, const Vector< dim > &to)
set the matrix to a rotation which will move 'from' to lie parallel to 'to'
RotMatrix & mirror (const int i)
set the matrix to a mirror perpendicular to the i'th axis
RotMatrix & mirror (const Vector< dim > &v)
set the matrix to a mirror perpendicular to the Vector v
RotMatrix & mirror ()
set the matrix to mirror all axes
RotMatrix & rotate (const RotMatrix &m)
rotate the matrix using another matrix
void normalize ()
normalize to remove accumulated round-off error
unsigned age () const
current round-off age
RotMatrix (const Quaternion &q, const bool not_flip=true)
3D only: Construct a RotMatrix from a Quaternion
RotMatrix & rotation (CoordType theta)
2D only: Construct a RotMatrix from an angle theta
RotMatrix & rotationX (CoordType theta)
3D only: set a RotMatrix to a rotation about the x axis by angle theta
RotMatrix & rotationY (CoordType theta)
3D only: set a RotMatrix to a rotation about the y axis by angle theta
RotMatrix & rotationZ (CoordType theta)
3D only: set a RotMatrix to a rotation about the z axis by angle theta
RotMatrix & rotation (const Vector< dim > &axis, CoordType theta)
3D only: set a RotMatrix to a rotation about the axis given by the Vector
RotMatrix & rotation (const Vector< dim > &axis)
3D only: set a RotMatrix to a rotation about the axis given by the Vector
RotMatrix & fromQuaternion (const Quaternion &q, const bool not_flip=true)
3D only: set a RotMatrix from a Quaternion
RotMatrix & rotate (const Quaternion &)
rotate the matrix using the quaternion
RotMatrix & mirrorX ()
set a RotMatrix to a mirror perpendicular to the x axis
RotMatrix & mirrorY ()
set a RotMatrix to a mirror perpendicular to the y axis
RotMatrix & mirrorZ ()
set a RotMatrix to a mirror perpendicular to the z axis

Friends

RotMatrix Prod (const RotMatrix &m1, const RotMatrix &m2)
returns m1 * m2
RotMatrix ProdInv (const RotMatrix &m1, const RotMatrix &m2)
returns m1 * m2^-1
RotMatrix InvProd (const RotMatrix &m1, const RotMatrix &m2)
returns m1^-1 * m2
RotMatrix InvProdInv (const RotMatrix &m1, const RotMatrix &m2)
returns m1^-1 * m2^-1
Vector< dim > Prod (const RotMatrix &m, const Vector< dim > &v)
returns m * v
Vector< dim > InvProd (const RotMatrix &m, const Vector< dim > &v)
returns m^-1 * v

Detailed Description

template<int dim = 3>

class WFMath::RotMatrix< dim >" A dim dimensional rotation matrix. Technically, a member of the group O(dim).

Elements of this class represent rotation matrices. The NxN dimensional rotation matrices form a group called O(N), the orthogonal matrices. They satisfy the following condition:

They are orthogonal. That is, their transpose is equal to their inverse. Hence, this class does not implement a transpose() method, only an inverse().

A general N dimensional matrix of this type has N(N-1)/2 degrees of freedom. This gives one rotation angle in 2D, the three Euler angles in 3D, etc.

This class implements the 'generic' subset of the interface in the fake class Shape.

Constructor & Destructor Documentation

template<int dim = 3> WFMath::RotMatrix< dim >::RotMatrix (const Quaternion & q, const bool not_flip = true)

3D only: Construct a RotMatrix from a Quaternion since Quaternions can only specify parity-even rotations, you can pass the return value of Quaternion::fromRotMatrix() as not_flip to recover the full RotMatrix

Member Function Documentation

template<int dim = 3> CoordType WFMath::RotMatrix< dim >::determinant () const [inline]

Get the determinant of the matrix. Since the matrix is orthogonal, the determinant is always either 1 or -1.

References WFMath::RotMatrix< dim >::inverse().

template<int dim = 3> RotMatrix& WFMath::RotMatrix< dim >::fromQuaternion (const Quaternion & q, const bool not_flip = true)

3D only: set a RotMatrix from a Quaternion since Quaternions can only specify parity-even rotations, you can pass the return value of Quaternion::fromRotMatrix() as not_flip to recover the full RotMatrix

Referenced by WFMath::RotMatrix< dim >::rotation(), and WFMath::RotMatrix< dim >::rotationZ().

template<int dim> RotMatrix< dim > WFMath::RotMatrix< dim >::inverse () const [inline]

Get the inverse of the matrix. Since the matrix is orthogonal, the inverse is equal to the transpose.

Referenced by WFMath::RotMatrix< dim >::determinant().

template<int dim> RotMatrix< dim > & WFMath::RotMatrix< dim >::mirror () [inline]

set the matrix to mirror all axes This is a good parity operator if dim is odd.

Referenced by WFMath::RotMatrix< dim >::mirrorX(), WFMath::RotMatrix< dim >::mirrorY(), and WFMath::RotMatrix< dim >::parity().

template<int dim = 3> bool WFMath::RotMatrix< dim >::parity () const [inline]

Get the parity of the matrix. Returns true for odd parity, false for even.

References WFMath::RotMatrix< dim >::mirror(), and WFMath::RotMatrix< dim >::rotation().

template<int dim> RotMatrix< dim > & WFMath::RotMatrix< dim >::rotation (const Vector< dim > & v1, const Vector< dim > & v2, CoordType theta)

set the matrix to a rotation by the angle theta in the v1, v2 plane Throws CollinearVectors if v1 and v2 are parallel

References WFMath::Vector< dim >::sqrMag().

template<int dim> RotMatrix< dim > & WFMath::RotMatrix< dim >::rotation (const Vector< dim > & from, const Vector< dim > & to)

set the matrix to a rotation which will move 'from' to lie parallel to 'to' Throws CollinearVectors if v1 and v2 are antiparallel (parallel but pointing in opposite directions). If v1 and v2 point in the same direction, the matrix is set to the identity.

References WFMath::RotMatrix< dim >::fromQuaternion(), WFMath::RotMatrix< dim >::rotate(), WFMath::RotMatrix< dim >::rotation(), and WFMath::Vector< dim >::sqrMag().

template<int dim = 3> RotMatrix& WFMath::RotMatrix< dim >::rotation (const Vector< dim > & axis)

3D only: set a RotMatrix to a rotation about the axis given by the Vector the rotation angle is taken from the Vector's magnitude

template<int dim> bool WFMath::RotMatrix< dim >::setVals (const CoordType vals[dim][dim], CoordType precision = numeric_constants<CoordType>::epsilon()) [inline]

Set the values of the elements of the matrix. Can't set one element at a time and keep it an O(N) matrix, but can try to set all values at once, and see if they match. This fails if the passed matrix is not orthogonal within the passed precision, and orthogonalizes the matrix to within precision WFMATH_EPSILON.

Referenced by WFMath::RotMatrix< dim >::elem().

template<int dim> bool WFMath::RotMatrix< dim >::setVals (const CoordType vals[dim *dim], CoordType precision = numeric_constants<CoordType>::epsilon()) [inline]

Set the values of the elements of the matrix. Can't set one element at a time and keep it an O(N) matrix, but can try to set all values at once, and see if they match. This fails if the passed matrix is not orthogonal within the passed precision, and orthogonalizes the matrix to within precision WFMATH_EPSILON.

Author

Generated automatically by Doxygen for WFMath from the source code.

Info

Fri Feb 5 2016 Version 1.0.2 WFMath