Bullet Collision Detection & Physics Library: btMatrix3x3 Class Reference

Bullet Collision Detection & Physics Library

Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
btMatrix3x3 Class Reference

The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with btQuaternion, btTransform and btVector3. More...

`#include <btMatrix3x3.h>`

Collaboration diagram for btMatrix3x3:
[legend]

## Public Member Functions
| btMatrix3x3 ()
| No initializaion constructor. More...
| btMatrix3x3 (const btQuaternion &q)
| Constructor from Quaternion. More...
| btMatrix3x3 (const btScalar &xx, const btScalar &xy, const btScalar &xz, const btScalar &yx, const btScalar &yy, const btScalar &yz, const btScalar &zx, const btScalar &zy, const btScalar &zz)
| Constructor with row major formatting. More...
| btMatrix3x3 (const btMatrix3x3 &other)
| Copy constructor. More...
btMatrix3x3 & | operator= (const btMatrix3x3 &other)
| Assignment Operator. More...
btVector3 | getColumn (int i) const
| Get a column of the matrix as a vector. More...
const btVector3 & | getRow (int i) const
| Get a row of the matrix as a vector. More...
btVector3 & | operator[] (int i)
| Get a mutable reference to a row of the matrix as a vector. More...
const btVector3 & | operator[] (int i) const
| Get a const reference to a row of the matrix as a vector. More...
btMatrix3x3 & | operator*= (const btMatrix3x3 &m)
| Multiply by the target matrix on the right. More...
btMatrix3x3 & | operator+= (const btMatrix3x3 &m)
| Adds by the target matrix on the right. More...
btMatrix3x3 & | operator-= (const btMatrix3x3 &m)
| Substractss by the target matrix on the right. More...
void | setFromOpenGLSubMatrix (const btScalar *m)
| Set from the rotational part of a 4x4 OpenGL matrix. More...
void | setValue (const btScalar &xx, const btScalar &xy, const btScalar &xz, const btScalar &yx, const btScalar &yy, const btScalar &yz, const btScalar &zx, const btScalar &zy, const btScalar &zz)
| Set the values of the matrix explicitly (row major) More...
void | setRotation (const btQuaternion &q)
| Set the matrix from a quaternion. More...
void | setEulerYPR (const btScalar &yaw, const btScalar &pitch, const btScalar &roll)
| Set the matrix from euler angles using YPR around YXZ respectively. More...
void | setEulerZYX (btScalar eulerX, btScalar eulerY, btScalar eulerZ)
| Set the matrix from euler angles YPR around ZYX axes. More...
void | setIdentity ()
| Set the matrix to the identity. More...
void | getOpenGLSubMatrix (btScalar *m) const
| Fill the rotational part of an OpenGL matrix and clear the shear/perspective. More...
void | getRotation (btQuaternion &q) const
| Get the matrix represented as a quaternion. More...
void | getEulerYPR (btScalar &yaw, btScalar &pitch, btScalar &roll) const
| Get the matrix represented as euler angles around YXZ, roundtrip with setEulerYPR. More...
void | getEulerZYX (btScalar &yaw, btScalar &pitch, btScalar &roll, unsigned int solution_number=1) const
| Get the matrix represented as euler angles around ZYX. More...
btMatrix3x3 | scaled (const btVector3 &s) const
| Create a scaled copy of the matrix. More...
btScalar | determinant () const
| Return the determinant of the matrix. More...
btMatrix3x3 | adjoint () const
| Return the adjoint of the matrix. More...
btMatrix3x3 | absolute () const
| Return the matrix with all values non negative. More...
btMatrix3x3 | transpose () const
| Return the transpose of the matrix. More...
btMatrix3x3 | inverse () const
| Return the inverse of the matrix. More...
btVector3 | solve33 (const btVector3 &b) const
| Solve A * x = b, where b is a column vector. More...
btMatrix3x3 | transposeTimes (const btMatrix3x3 &m) const
btMatrix3x3 | timesTranspose (const btMatrix3x3 &m) const
btScalar | tdotx (const btVector3 &v) const
btScalar | tdoty (const btVector3 &v) const
btScalar | tdotz (const btVector3 &v) const
void | extractRotation (btQuaternion &q, btScalar tolerance=1.0e-9, int maxIter=100)
| extractRotation is from "A robust method to extract the rotational part of deformations" See http://dl.acm.org/citation.cfm?doid=2994258.2994269 More...
void | diagonalize (btMatrix3x3 &rot, btScalar tolerance=1.0e-9, int maxIter=100)
| diagonalizes this matrix More...
btScalar | cofac (int r1, int c1, int r2, int c2) const
| Calculate the matrix cofactor. More...
void | serialize (struct btMatrix3x3Data &dataOut) const
void | serializeFloat (struct btMatrix3x3FloatData &dataOut) const
void | deSerialize (const struct btMatrix3x3Data &dataIn)
void | deSerializeFloat (const struct btMatrix3x3FloatData &dataIn)
void | deSerializeDouble (const struct btMatrix3x3DoubleData &dataIn)

## Static Public Member Functions
static const btMatrix3x3 & | getIdentity ()

## Private Attributes
btVector3 | m_el [3]
| Data storage for the matrix, each vector is a row of the matrix. More...

## Detailed Description

The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with btQuaternion, btTransform and btVector3.

Make sure to only include a pure orthogonal matrix without scaling.

Definition at line 48 of file btMatrix3x3.h.

## Constructor & Destructor Documentation

## ◆ btMatrix3x3() [1/4]

btMatrix3x3::btMatrix3x3 | ( |  | ) |
| inline

No initializaion constructor.

Definition at line 55 of file btMatrix3x3.h.

## ◆ btMatrix3x3() [2/4]

btMatrix3x3::btMatrix3x3 | ( | const btQuaternion & | q | ) |
| inlineexplicit

Constructor from Quaternion.

Definition at line 60 of file btMatrix3x3.h.

## ◆ btMatrix3x3() [3/4]

btMatrix3x3::btMatrix3x3 | ( | const btScalar & | xx,
|  | const btScalar & | xy,
|  | const btScalar & | xz,
|  | const btScalar & | yx,
|  | const btScalar & | yy,
|  | const btScalar & | yz,
|  | const btScalar & | zx,
|  | const btScalar & | zy,
|  | const btScalar & | zz
| ) |  |
| inline

Constructor with row major formatting.

Definition at line 69 of file btMatrix3x3.h.

## ◆ btMatrix3x3() [4/4]

btMatrix3x3::btMatrix3x3 | ( | const btMatrix3x3 & | other | ) |
| inline

Copy constructor.

Definition at line 114 of file btMatrix3x3.h.

## Member Function Documentation

## ◆ absolute()

btMatrix3x3 btMatrix3x3::absolute | ( |  | ) | const
| inline

Return the matrix with all values non negative.

Definition at line 937 of file btMatrix3x3.h.

## ◆ adjoint()

btMatrix3x3 btMatrix3x3::adjoint | ( |  | ) | const
| inline

Return the adjoint of the matrix.

Definition at line 995 of file btMatrix3x3.h.

## ◆ cofac()

btScalar btMatrix3x3::cofac | ( | int | r1,
|  | int | c1,
|  | int | r2,
|  | int | c2
| ) |  | const
| inline

Calculate the matrix cofactor.

Parameters

  r1 | The first row to use for calculating the cofactor
  c1 | The first column to use for calculating the cofactor
  r1 | The second row to use for calculating the cofactor
  c1 | The second column to use for calculating the cofactor See http://en.wikipedia.org/wiki/Cofactor_(linear_algebra) for more details

Definition at line 705 of file btMatrix3x3.h.

## ◆ deSerialize()

void btMatrix3x3::deSerialize | ( | const struct btMatrix3x3Data & | dataIn | ) |
| inline

Definition at line 1329 of file btMatrix3x3.h.

## ◆ deSerializeDouble()

void btMatrix3x3::deSerializeDouble | ( | const struct btMatrix3x3DoubleData & | dataIn | ) |
| inline

Definition at line 1341 of file btMatrix3x3.h.

## ◆ deSerializeFloat()

void btMatrix3x3::deSerializeFloat | ( | const struct btMatrix3x3FloatData & | dataIn | ) |
| inline

Definition at line 1335 of file btMatrix3x3.h.

## ◆ determinant()

btScalar btMatrix3x3::determinant | ( |  | ) | const
| inline

Return the determinant of the matrix.

Definition at line 930 of file btMatrix3x3.h.

## ◆ diagonalize()

void btMatrix3x3::diagonalize | ( | btMatrix3x3 & | rot,
|  | btScalar | tolerance = `1.0e-9`,
|  | int | maxIter = `100`
| ) |  |
| inline

diagonalizes this matrix

Parameters

  rot | stores the rotation from the coordinate system in which the matrix is diagonal to the original coordinate system, i.e., old_this = rot * new_this * rot^T.
  threshold | See iteration
  maxIter | The iteration stops when we hit the given tolerance or when maxIter have been executed.

Definition at line 682 of file btMatrix3x3.h.

## ◆ extractRotation()

void btMatrix3x3::extractRotation | ( | btQuaternion & | q,
|  | btScalar | tolerance = `1.0e-9`,
|  | int | maxIter = `100`
| ) |  |
| inline

extractRotation is from "A robust method to extract the rotational part of deformations" See http://dl.acm.org/citation.cfm?doid=2994258.2994269

Definition at line 652 of file btMatrix3x3.h.

## ◆ getColumn()

btVector3 btMatrix3x3::getColumn | ( | int | i | ) | const
| inline

Get a column of the matrix as a vector.

Parameters

  i | Column number 0 indexed

Definition at line 134 of file btMatrix3x3.h.

## ◆ getEulerYPR()

void btMatrix3x3::getEulerYPR | ( | btScalar & | yaw,
|  | btScalar & | pitch,
|  | btScalar & | roll
| ) |  | const
| inline

Get the matrix represented as euler angles around YXZ, roundtrip with setEulerYPR.

Parameters

  yaw | Yaw around Y axis
  pitch | Pitch around X axis
  roll | around Z axis

Definition at line 492 of file btMatrix3x3.h.

## ◆ getEulerZYX()

void btMatrix3x3::getEulerZYX | ( | btScalar & | yaw,
|  | btScalar & | pitch,
|  | btScalar & | roll,
|  | unsigned int | solution_number = `1`
| ) |  | const
| inline

Get the matrix represented as euler angles around ZYX.

Parameters

  yaw | Yaw around X axis
  pitch | Pitch around Y axis
  roll | around X axis
  solution_number | Which solution of two possible solutions ( 1 or 2) are possible values

Definition at line 521 of file btMatrix3x3.h.

## ◆ getIdentity()

static const btMatrix3x3& btMatrix3x3::getIdentity | ( |  | ) |
| inlinestatic

Definition at line 330 of file btMatrix3x3.h.

## ◆ getOpenGLSubMatrix()

void btMatrix3x3::getOpenGLSubMatrix | ( | btScalar * | m | ) | const
| inline

Fill the rotational part of an OpenGL matrix and clear the shear/perspective.

Parameters

  m | The array to be filled

Definition at line 347 of file btMatrix3x3.h.

## ◆ getRotation()

void btMatrix3x3::getRotation | ( | btQuaternion & | q | ) | const
| inline

Get the matrix represented as a quaternion.

Parameters

  q | The quaternion which will be set

Definition at line 400 of file btMatrix3x3.h.

## ◆ getRow()

const btVector3& btMatrix3x3::getRow | ( | int | i | ) | const
| inline

Get a row of the matrix as a vector.

Parameters

  i | Row number 0 indexed

Definition at line 142 of file btMatrix3x3.h.

## ◆ inverse()

btMatrix3x3 btMatrix3x3::inverse | ( |  | ) | const
| inline

Return the inverse of the matrix.

Definition at line 1003 of file btMatrix3x3.h.

## ◆ operator*=()

btMatrix3x3 & btMatrix3x3::operator*= | ( | const btMatrix3x3 & | m | ) |
| inline

Multiply by the target matrix on the right.

Parameters

  m | Rotation matrix to be applied Equivilant to this = this * m

Definition at line 724 of file btMatrix3x3.h.

## ◆ operator+=()

btMatrix3x3 & btMatrix3x3::operator+= | ( | const btMatrix3x3 & | m | ) |
| inline

Adds by the target matrix on the right.

Parameters

  m | matrix to be applied Equivilant to this = this + m

Definition at line 814 of file btMatrix3x3.h.

## ◆ operator-=()

btMatrix3x3 & btMatrix3x3::operator-= | ( | const btMatrix3x3 & | m | ) |
| inline

Substractss by the target matrix on the right.

Parameters

  m | matrix to be applied Equivilant to this = this - m

Definition at line 907 of file btMatrix3x3.h.

## ◆ operator=()

btMatrix3x3& btMatrix3x3::operator= | ( | const btMatrix3x3 & | other | ) |
| inline

Assignment Operator.

Definition at line 122 of file btMatrix3x3.h.

## ◆ operator[]() [1/2]

btVector3& btMatrix3x3::operator[] | ( | int | i | ) |
| inline

Get a mutable reference to a row of the matrix as a vector.

Parameters

  i | Row number 0 indexed

Definition at line 150 of file btMatrix3x3.h.

## ◆ operator[]() [2/2]

const btVector3& btMatrix3x3::operator[] | ( | int | i | ) | const
| inline

Get a const reference to a row of the matrix as a vector.

Parameters

  i | Row number 0 indexed

Definition at line 158 of file btMatrix3x3.h.

## ◆ scaled()

btMatrix3x3 btMatrix3x3::scaled | ( | const btVector3 & | s | ) | const
| inline

Create a scaled copy of the matrix.

Parameters

  s | Scaling vector The elements of the vector will scale each column

Definition at line 590 of file btMatrix3x3.h.

## ◆ serialize()

void btMatrix3x3::serialize | ( | struct btMatrix3x3Data & | dataOut | ) | const
| inline

Definition at line 1316 of file btMatrix3x3.h.

## ◆ serializeFloat()

void btMatrix3x3::serializeFloat | ( | struct btMatrix3x3FloatData & | dataOut | ) | const
| inline

Definition at line 1322 of file btMatrix3x3.h.

## ◆ setEulerYPR()

void btMatrix3x3::setEulerYPR | ( | const btScalar & | yaw,
|  | const btScalar & | pitch,
|  | const btScalar & | roll
| ) |  |
| inline

Set the matrix from euler angles using YPR around YXZ respectively.

Parameters

  yaw | Yaw about Y axis
  pitch | Pitch about X axis
  roll | Roll about Z axis

Definition at line 284 of file btMatrix3x3.h.

## ◆ setEulerZYX()

void btMatrix3x3::setEulerZYX | ( | btScalar | eulerX,
|  | btScalar | eulerY,
|  | btScalar | eulerZ
| ) |  |
| inline

Set the matrix from euler angles YPR around ZYX axes.

Parameters

  eulerX | Roll about X axis
  eulerY | Pitch around Y axis
  eulerZ | Yaw aboud Z axis

These angles are used to produce a rotation matrix. The euler angles are applied in ZYX order. I.e a vector is first rotated about X then Y and then Z

Definition at line 298 of file btMatrix3x3.h.

## ◆ setFromOpenGLSubMatrix()

void btMatrix3x3::setFromOpenGLSubMatrix | ( | const btScalar * | m | ) |
| inline

Set from the rotational part of a 4x4 OpenGL matrix.

Parameters

  m | A pointer to the beginning of the array of scalars

Definition at line 181 of file btMatrix3x3.h.

## ◆ setIdentity()

void btMatrix3x3::setIdentity | ( |  | ) |
| inline

Set the matrix to the identity.

Definition at line 317 of file btMatrix3x3.h.

## ◆ setRotation()

void btMatrix3x3::setRotation | ( | const btQuaternion & | q | ) |
| inline

Set the matrix from a quaternion.

Parameters

  q | The Quaternion to match

Definition at line 209 of file btMatrix3x3.h.

## ◆ setValue()

void btMatrix3x3::setValue | ( | const btScalar & | xx,
|  | const btScalar & | xy,
|  | const btScalar & | xz,
|  | const btScalar & | yx,
|  | const btScalar & | yy,
|  | const btScalar & | yz,
|  | const btScalar & | zx,
|  | const btScalar & | zy,
|  | const btScalar & | zz
| ) |  |
| inline

Set the values of the matrix explicitly (row major)

Parameters

  xx | Top left
  xy | Top Middle
  xz | Top Right
  yx | Middle Left
  yy | Middle Middle
  yz | Middle Right
  zx | Bottom Left
  zy | Bottom Middle
  zz | Bottom Right

Definition at line 198 of file btMatrix3x3.h.

## ◆ solve33()

btVector3 btMatrix3x3::solve33 | ( | const btVector3 & | b | ) | const
| inline

Solve A * x = b, where b is a column vector.

This is more efficient than computing the inverse in one-shot cases. Solve33 is from Box2d, thanks to Erin Catto,

Definition at line 616 of file btMatrix3x3.h.

## ◆ tdotx()

btScalar btMatrix3x3::tdotx | ( | const btVector3 & | v | ) | const
| inline

Definition at line 637 of file btMatrix3x3.h.

## ◆ tdoty()

btScalar btMatrix3x3::tdoty | ( | const btVector3 & | v | ) | const
| inline

Definition at line 641 of file btMatrix3x3.h.

## ◆ tdotz()

btScalar btMatrix3x3::tdotz | ( | const btVector3 & | v | ) | const
| inline

Definition at line 645 of file btMatrix3x3.h.

## ◆ timesTranspose()

btMatrix3x3 btMatrix3x3::timesTranspose | ( | const btMatrix3x3 & | m | ) | const
| inline

Definition at line 1072 of file btMatrix3x3.h.

## ◆ transpose()

btMatrix3x3 btMatrix3x3::transpose | ( |  | ) | const
| inline

Return the transpose of the matrix.

Definition at line 958 of file btMatrix3x3.h.

## ◆ transposeTimes()

btMatrix3x3 btMatrix3x3::transposeTimes | ( | const btMatrix3x3 & | m | ) | const
| inline

Definition at line 1016 of file btMatrix3x3.h.

## Member Data Documentation

## ◆ m_el

btVector3 btMatrix3x3::m_el[3]
| private

Data storage for the matrix, each vector is a row of the matrix.

Definition at line 51 of file btMatrix3x3.h.

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

- btMatrix3x3.h