26 #ifndef WFMATH_ROTMATRIX_H 27 #define WFMATH_ROTMATRIX_H 29 #include <wfmath/const.h> 37 RotMatrix<dim>
Prod(
const RotMatrix<dim>& m1,
const RotMatrix<dim>& m2);
40 RotMatrix<dim>
ProdInv(
const RotMatrix<dim>& m1,
const RotMatrix<dim>& m2);
43 RotMatrix<dim>
InvProd(
const RotMatrix<dim>& m1,
const RotMatrix<dim>& m2);
46 RotMatrix<dim>
InvProdInv(
const RotMatrix<dim>& m1,
const RotMatrix<dim>& m2);
49 Vector<dim>
Prod(
const RotMatrix<dim>& m,
const Vector<dim>& v);
51 Vector<dim>
InvProd(
const RotMatrix<dim>& m,
const Vector<dim>& v);
53 Vector<dim>
Prod(
const Vector<dim>& v,
const RotMatrix<dim>& m);
55 Vector<dim>
ProdInv(
const Vector<dim>& v,
const RotMatrix<dim>& m);
59 RotMatrix<dim>
operator*(
const RotMatrix<dim>& m1,
const RotMatrix<dim>& m2);
61 Vector<dim>
operator*(
const RotMatrix<dim>& m,
const Vector<dim>& v);
63 Vector<dim>
operator*(
const Vector<dim>& v,
const RotMatrix<dim>& m);
66 std::ostream& operator<<(std::ostream& os, const RotMatrix<dim>& m);
68 std::istream& operator>>(std::istream& is, RotMatrix<dim>& m);
90 RotMatrix() : m_flip(false), m_valid(false), m_age(0) {}
92 RotMatrix(
const RotMatrix& m);
94 friend std::ostream& operator<< <dim>(std::ostream& os,
const RotMatrix& m);
95 friend std::istream&
operator>> <dim>(std::istream& is, RotMatrix& m);
97 RotMatrix& operator=(
const 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();}
281 #endif // WFMATH_ROTMATRIX_H Generic library namespace.
Definition: atlasconv.h:45
Vector< dim > row(const int i) const
Get a copy of the i'th row as a Vector.
Definition: rotmatrix_funcs.h:293
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
unsigned age() const
current round-off age
Definition: rotmatrix.h:201
RotMatrix & mirrorX()
set a RotMatrix to a mirror perpendicular to the x axis
Definition: rotmatrix.h:245
RotMatrix< dim > InvProdInv(const RotMatrix< dim > &m1, const RotMatrix< dim > &m2)
returns m1^-1 * m2^-1
Definition: rotmatrix_funcs.h:155
RotMatrix & rotationX(CoordType theta)
3D only: set a RotMatrix to a rotation about the x axis by angle theta
Definition: rotmatrix.h:219
A dim dimensional rotation matrix. Technically, a member of the group O(dim).
Definition: const.h:53
RotMatrix & rotation(CoordType theta)
2D only: Construct a RotMatrix from an angle theta
Definition: rotmatrix.h:215
RotMatrix< dim > InvProd(const RotMatrix< dim > &m1, const RotMatrix< dim > &m2)
returns m1^-1 * m2
Definition: rotmatrix_funcs.h:133
RotMatrix & rotate(const RotMatrix &m)
rotate the matrix using another matrix
Definition: rotmatrix.h:196
RotMatrix & mirrorY()
set a RotMatrix to a mirror perpendicular to the y axis
Definition: rotmatrix.h:247
A dim dimensional vector.
Definition: const.h:55
RotMatrix & fromQuaternion(const Quaternion &q, const bool not_flip=true)
3D only: set a RotMatrix from a Quaternion
RotMatrix & rotationZ(CoordType theta)
3D only: set a RotMatrix to a rotation about the z axis by angle theta
Definition: rotmatrix.h:223
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
float CoordType
Basic floating point type.
Definition: const.h:140
RotMatrix & rotationY(CoordType theta)
3D only: set a RotMatrix to a rotation about the y axis by angle theta
Definition: rotmatrix.h:221
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
CoordType determinant() const
Get the determinant of the matrix.
Definition: rotmatrix.h:144
RotMatrix & mirror()
set the matrix to mirror all axes
Definition: rotmatrix_funcs.h:538
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
friend RotMatrix Prod(const RotMatrix &m1, const RotMatrix &m2)
returns m1 * m2
Definition: rotmatrix_funcs.h:89
RotMatrix< dim > operator*(const RotMatrix< dim > &m1, const RotMatrix< dim > &m2)
returns m1 * m2
Definition: rotmatrix_funcs.h:223
RotMatrix & mirrorZ()
set a RotMatrix to a mirror perpendicular to the z axis
RotMatrix< dim > ProdInv(const RotMatrix< dim > &m1, const RotMatrix< dim > &m2)
returns m1 * m2^-1
Definition: rotmatrix_funcs.h:111
A normalized quaterion.
Definition: quaternion.h:35
RotMatrix< dim > Prod(const RotMatrix< dim > &m1, const RotMatrix< dim > &m2)
returns m1 * m2
Definition: rotmatrix_funcs.h:89
CoordType elem(const int i, const int j) const
get the (i, j) element of the matrix
Definition: rotmatrix.h:112
CoordType trace() const
Get the trace of the matrix.
Definition: rotmatrix_funcs.h:349
RotMatrix inverse() const
Get the inverse of the matrix.
Definition: rotmatrix_funcs.h:319