26#ifndef WFMATH_ROTMATRIX_H
27#define WFMATH_ROTMATRIX_H
29#include <wfmath/const.h>
37RotMatrix<dim>
Prod(
const RotMatrix<dim>& m1,
const RotMatrix<dim>& m2);
40RotMatrix<dim>
ProdInv(
const RotMatrix<dim>& m1,
const RotMatrix<dim>& m2);
43RotMatrix<dim>
InvProd(
const RotMatrix<dim>& m1,
const RotMatrix<dim>& m2);
46RotMatrix<dim>
InvProdInv(
const RotMatrix<dim>& m1,
const RotMatrix<dim>& m2);
49Vector<dim>
Prod(
const RotMatrix<dim>& m,
const Vector<dim>& v);
51Vector<dim>
InvProd(
const RotMatrix<dim>& m,
const Vector<dim>& v);
53Vector<dim>
Prod(
const Vector<dim>& v,
const RotMatrix<dim>& m);
55Vector<dim>
ProdInv(
const Vector<dim>& v,
const RotMatrix<dim>& m);
59RotMatrix<dim>
operator*(
const RotMatrix<dim>& m1,
const RotMatrix<dim>& m2);
61Vector<dim>
operator*(
const RotMatrix<dim>& m,
const Vector<dim>& v);
63Vector<dim>
operator*(
const Vector<dim>& v,
const RotMatrix<dim>& m);
66std::ostream& operator<<(std::ostream& os,
const RotMatrix<dim>& m);
68std::istream& operator>>(std::istream& is, RotMatrix<dim>& m);
90 RotMatrix() : m_flip(
false), m_valid(
false), m_age(0) {}
94 friend std::ostream& operator<< <dim>(std::ostream& os,
const RotMatrix& m);
95 friend std::istream&
operator>> <dim>(std::istream& is,
RotMatrix& m);
101 bool isEqualTo(
const RotMatrix& m,
CoordType epsilon = numeric_constants<CoordType>::epsilon())
const;
103 bool operator==(
const RotMatrix& m)
const {
return isEqualTo(m);}
104 bool operator!=(
const RotMatrix& m)
const {
return !isEqualTo(m);}
106 bool isValid()
const {
return m_valid;}
201 unsigned age()
const {
return m_age;}
258 bool _setVals(
CoordType *vals,
CoordType precision = numeric_constants<CoordType>::epsilon());
259 void checkNormalization() {
if(m_age >= WFMATH_MAX_NORM_AGE && m_valid)
normalize();}
A normalized quaterion.
Definition quaternion.h:36
A dim dimensional rotation matrix. Technically, a member of the group O(dim).
Definition rotmatrix.h:87
friend RotMatrix InvProd(const RotMatrix &m1, const RotMatrix &m2)
returns m1^-1 * m2
Definition rotmatrix_funcs.h:133
RotMatrix & mirrorZ()
set a RotMatrix to a mirror perpendicular to the z axis
friend RotMatrix Prod(const RotMatrix &m1, const RotMatrix &m2)
returns m1 * m2
Definition rotmatrix_funcs.h:89
RotMatrix & rotationY(CoordType theta)
3D only: set a RotMatrix to a rotation about the y axis by angle theta
Definition rotmatrix.h:221
Vector< dim > row(const int i) const
Get a copy of the i'th row as a Vector.
Definition rotmatrix_funcs.h:293
RotMatrix & rotate(const RotMatrix &m)
rotate the matrix using another matrix
Definition rotmatrix.h:196
RotMatrix(const Quaternion &q, const bool not_flip=true)
3D only: Construct a RotMatrix from a Quaternion
RotMatrix & mirrorX()
set a RotMatrix to a mirror perpendicular to the x axis
Definition rotmatrix.h:245
friend RotMatrix InvProdInv(const RotMatrix &m1, const RotMatrix &m2)
returns m1^-1 * m2^-1
Definition rotmatrix_funcs.h:155
RotMatrix & rotation(const Vector< dim > &axis, CoordType theta)
3D only: set a RotMatrix to a rotation about the axis given by the Vector
RotMatrix & identity()
set the matrix to the identity matrix
Definition rotmatrix_funcs.h:335
bool parity() const
Get the parity of the matrix.
Definition rotmatrix.h:154
CoordType trace() const
Get the trace of the matrix.
Definition rotmatrix_funcs.h:349
CoordType elem(const int i, const int j) const
get the (i, j) element of the matrix
Definition rotmatrix.h:112
RotMatrix & rotationZ(CoordType theta)
3D only: set a RotMatrix to a rotation about the z axis by angle theta
Definition rotmatrix.h:223
friend RotMatrix ProdInv(const RotMatrix &m1, const RotMatrix &m2)
returns m1 * m2^-1
Definition rotmatrix_funcs.h:111
RotMatrix & mirrorY()
set a RotMatrix to a mirror perpendicular to the y axis
Definition rotmatrix.h:247
RotMatrix & rotationX(CoordType theta)
3D only: set a RotMatrix to a rotation about the x axis by angle theta
Definition rotmatrix.h:219
Vector< dim > column(const int i) const
Get a copy of the i'th column as a Vector.
Definition rotmatrix_funcs.h:306
void normalize()
normalize to remove accumulated round-off error
Definition rotmatrix_funcs.h:555
RotMatrix & mirror()
set the matrix to mirror all axes
Definition rotmatrix_funcs.h:538
RotMatrix & rotation(CoordType theta)
2D only: Construct a RotMatrix from an angle theta
Definition rotmatrix.h:215
RotMatrix inverse() const
Get the inverse of the matrix.
Definition rotmatrix_funcs.h:319
unsigned age() const
current round-off age
Definition rotmatrix.h:201
RotMatrix & rotate(const Quaternion &)
rotate the matrix using the quaternion
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
Definition rotmatrix_funcs.h:360
RotMatrix & mirror(const int i)
set the matrix to a mirror perpendicular to the i'th axis
Definition rotmatrix.h:269
RotMatrix & rotation(const Vector< dim > &axis)
3D only: set a RotMatrix to a rotation about the axis given by the Vector
bool setVals(const CoordType vals[dim][dim], CoordType precision=numeric_constants< CoordType >::epsilon())
Set the values of the elements of the matrix.
Definition rotmatrix_funcs.h:241
RotMatrix & fromQuaternion(const Quaternion &q, const bool not_flip=true)
3D only: set a RotMatrix from a Quaternion
CoordType determinant() const
Get the determinant of the matrix.
Definition rotmatrix.h:144
A dim dimensional vector.
Definition vector.h:121
Generic library namespace.
Definition atlasconv.h:45
RotMatrix< dim > InvProd(const RotMatrix< dim > &m1, const RotMatrix< dim > &m2)
returns m1^-1 * m2
Definition rotmatrix_funcs.h:133
RotMatrix< dim > Prod(const RotMatrix< dim > &m1, const RotMatrix< dim > &m2)
returns m1 * m2
Definition rotmatrix_funcs.h:89
RotMatrix< dim > InvProdInv(const RotMatrix< dim > &m1, const RotMatrix< dim > &m2)
returns m1^-1 * m2^-1
Definition rotmatrix_funcs.h:155
float CoordType
Basic floating point type.
Definition const.h:140
RotMatrix< dim > ProdInv(const RotMatrix< dim > &m1, const RotMatrix< dim > &m2)
returns m1 * m2^-1
Definition rotmatrix_funcs.h:111
RotMatrix< dim > operator*(const RotMatrix< dim > &m1, const RotMatrix< dim > &m2)
returns m1 * m2
Definition rotmatrix_funcs.h:223