molecular
Public Types | Public Member Functions | Static Public Member Functions | List of all members
molecular::util::Matrix3 Class Reference

Rotation matrix. More...

#include <Matrix3.h>

Inheritance diagram for molecular::util::Matrix3:
molecular::util::Matrix< 3, 3 >

Public Types

using Super = Matrix< 3, 3 >
 
- Public Types inherited from molecular::util::Matrix< 3, 3 >
using ValueType = float
 

Public Member Functions

 Matrix3 ()
 
 Matrix3 (ValueType m00, ValueType m01, ValueType m02, ValueType m10, ValueType m11, ValueType m12, ValueType m20, ValueType m21, ValueType m22)
 
 Matrix3 (Super s)
 
 Matrix3 (const ValueType values[9])
 
 Matrix3 (const Matrix< 3, 4 > &mat)
 
 Matrix3 (const Quaternion &quaternion)
 Construct a rotation matrix out of a quaternion. More...
 
 Matrix3 (const Vector3 &xBasis, const Vector3 &yBasis, const Vector3 &zBasis)
 Construct matrix out of three basis vectors. More...
 
Vector3 operator* (const Vector3 &v) const
 Matrix-vector multiplication. More...
 
Quaternion ToQuaternion () const
 Convert to Quaternion. More...
 
Matrix3 GetRotation () const
 Get rotation without scaling. More...
 
ValueType GetScale () const
 
ValueType Determinant () const
 
- Public Member Functions inherited from molecular::util::Matrix< 3, 3 >
 Matrix ()=default
 Default constructor. More...
 
 Matrix (const floatvalues[rows *cols])
 Construct matrix from an array in row-major order. More...
 
 Matrix (const floatvalues[rows][cols])
 Construct matrix from two-dimensional array. More...
 
 Matrix (std::initializer_list< float > init)
 
 Matrix (const Eigen::MatrixBase< OtherDerived > &other)
 Construct from Eigen expression. More...
 
Matrixoperator= (const Eigen::MatrixBase< OtherDerived > &other)
 Assign from Eigen expression. More...
 
const float * Get () const
 Returns array of matrix elements in row-major order. More...
 
float * operator[] (int row)
 
const float * operator[] (int row) const
 
float operator() (int row, int col) const
 
float & operator() (int row, int col)
 
auto ToEigen ()
 
auto ToEigen () const
 
Matrix< rows, M::kCols, float > operator* (const M &mat) const
 Matrix-matrix multiplication. More...
 
Matrix operator* (ValueType s) const
 Matrix-scalar multiplication. More...
 
Matrix operator+ (const Matrix &mat) const
 
Matrixoperator+= (const Matrix &mat)
 
Matrixoperator*= (const Matrix &mat)
 
Matrixoperator*= (ValueType s)
 
Matrixoperator/= (ValueType s)
 
void SetIdentity ()
 
Matrix< M::kRows, M::kCols+cols, float > Augmented (const M &mat) const
 Returns the matrix with mat concatenated to the right side. More...
 
Matrix< rows, newcols, float > SubMatrixRight () const
 Returns the right portion of the matrix with the given width. More...
 
Matrix< rows, newcols, float > SubMatrixLeft () const
 Returns the left portion of the matrix with the given width. More...
 
void Print () const
 
Matrix< rows, cols, float > Inverse () const
 Returns the inverse of the matrix. More...
 
Matrix< cols, rows, float > Transposed () const
 Returns the transposed of the matrix. More...
 
float Trace () const
 Returns the sum of the diagonal elements. More...
 

Static Public Member Functions

static Matrix3 LookAtX (const Vector3 &at, const Vector3 &up=Vector3(0, 1, 0))
 
static Matrix3 LookAtZ (const Vector3 &at, const Vector3 &up=Vector3(0, 1, 0))
 
static Matrix3 RotationX (float a)
 
static Matrix3 RotationY (float a)
 
static Matrix3 RotationZ (float a)
 
static Matrix3 Scale (ValueType s)
 
static Matrix3 Scale (ValueType sx, ValueType sy, ValueType sz)
 
- Static Public Member Functions inherited from molecular::util::Matrix< 3, 3 >
static Matrix Identity ()
 
static Matrix Zeros ()
 

Additional Inherited Members

- Static Public Attributes inherited from molecular::util::Matrix< 3, 3 >
static const int kRows
 
static const int kCols
 
- Protected Attributes inherited from molecular::util::Matrix< 3, 3 >
float m [rows][cols]
 

Detailed Description

Rotation matrix.

The following convention is used: Consecutive transformations (e.g. A, B, C) have to be multiplied from right to left (C * B * A). To transform a Vector3 (which is a column vector), multiply it right of the matrix (e.g. x' = A * x).

Member Typedef Documentation

Constructor & Destructor Documentation

molecular::util::Matrix3::Matrix3 ( )
inline
molecular::util::Matrix3::Matrix3 ( ValueType  m00,
ValueType  m01,
ValueType  m02,
ValueType  m10,
ValueType  m11,
ValueType  m12,
ValueType  m20,
ValueType  m21,
ValueType  m22 
)
inline
molecular::util::Matrix3::Matrix3 ( Super  s)
inline
molecular::util::Matrix3::Matrix3 ( const ValueType  values[9])
inline
molecular::util::Matrix3::Matrix3 ( const Matrix< 3, 4 > &  mat)
inline
molecular::util::Matrix3::Matrix3 ( const Quaternion quaternion)
inline

Construct a rotation matrix out of a quaternion.

molecular::util::Matrix3::Matrix3 ( const Vector3 xBasis,
const Vector3 yBasis,
const Vector3 zBasis 
)
inline

Construct matrix out of three basis vectors.

Member Function Documentation

ValueType molecular::util::Matrix3::Determinant ( ) const
inline
Matrix3 molecular::util::Matrix3::GetRotation ( ) const
inline

Get rotation without scaling.

Works for uniform scaling only!

ValueType molecular::util::Matrix3::GetScale ( ) const
inline
static Matrix3 molecular::util::Matrix3::LookAtX ( const Vector3 at,
const Vector3 up = Vector3(0,1,0) 
)
inlinestatic
static Matrix3 molecular::util::Matrix3::LookAtZ ( const Vector3 at,
const Vector3 up = Vector3(0,1,0) 
)
inlinestatic
Vector3 molecular::util::Matrix3::operator* ( const Vector3 v) const
inline

Matrix-vector multiplication.

static Matrix3 molecular::util::Matrix3::RotationX ( float  a)
inlinestatic
static Matrix3 molecular::util::Matrix3::RotationY ( float  a)
inlinestatic
static Matrix3 molecular::util::Matrix3::RotationZ ( float  a)
inlinestatic
static Matrix3 molecular::util::Matrix3::Scale ( ValueType  s)
inlinestatic
static Matrix3 molecular::util::Matrix3::Scale ( ValueType  sx,
ValueType  sy,
ValueType  sz 
)
inlinestatic
Quaternion molecular::util::Matrix3::ToQuaternion ( ) const
inline

Convert to Quaternion.

Only works if this matrix represents pure rotation. See http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm


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