Blender  V3.3
Classes | Macros | Functions | Variables
btMatrix3x3.h File Reference
#include "btVector3.h"
#include "btQuaternion.h"
#include <stdio.h>

Go to the source code of this file.

Classes

struct  btMatrix3x3FloatData
 for serialization More...
 
struct  btMatrix3x3DoubleData
 for serialization More...
 

Macros

#define btMatrix3x3Data   btMatrix3x3FloatData
 

Functions

 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...
 
SIMD_FORCE_INLINE btMatrix3x3 (const btMatrix3x3 &other)
 Copy constructor. More...
 
SIMD_FORCE_INLINE btMatrix3x3operator= (const btMatrix3x3 &other)
 Assignment Operator. More...
 
SIMD_FORCE_INLINE btMatrix3x3 (const btVector3 &v0, const btVector3 &v1, const btVector3 &v2)
 
SIMD_FORCE_INLINE btVector3 getColumn (int i) const
 Get a column of the matrix as a vector. More...
 
SIMD_FORCE_INLINE const btVector3getRow (int i) const
 Get a row of the matrix as a vector. More...
 
SIMD_FORCE_INLINE btVector3operator[] (int i)
 Get a mutable reference to a row of the matrix as a vector. More...
 
btMatrix3x3operator*= (const btMatrix3x3 &m)
 Multiply by the target matrix on the right. More...
 
btMatrix3x3operator+= (const btMatrix3x3 &m)
 Adds by the target matrix on the right. More...
 
btMatrix3x3operator-= (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 setZero ()
 Set the matrix to the identity. More...
 
static const btMatrix3x3getIdentity ()
 
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
 
btMatrix3x3 transposeTimes (const btMatrix3x3 &m) const
 
btMatrix3x3 timesTranspose (const btMatrix3x3 &m) const
 
SIMD_FORCE_INLINE btScalar tdotx (const btVector3 &v) const
 
SIMD_FORCE_INLINE btScalar tdoty (const btVector3 &v) const
 
SIMD_FORCE_INLINE btScalar tdotz (const btVector3 &v) const
 
SIMD_FORCE_INLINE void extractRotation (btQuaternion &q, btScalar tolerance=1.0e-9, int maxIter=100)
 
void diagonalize (btMatrix3x3 &rot, btScalar threshold, int maxSteps)
 diagonalizes this matrix by the Jacobi method. 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)
 
SIMD_FORCE_INLINE btMatrix3x3 operator* (const btMatrix3x3 &m, const btScalar &k)
 
SIMD_FORCE_INLINE btMatrix3x3 operator+ (const btMatrix3x3 &m1, const btMatrix3x3 &m2)
 
SIMD_FORCE_INLINE btMatrix3x3 operator- (const btMatrix3x3 &m1, const btMatrix3x3 &m2)
 
SIMD_FORCE_INLINE btVector3 operator* (const btMatrix3x3 &m, const btVector3 &v)
 
SIMD_FORCE_INLINE btVector3 operator* (const btVector3 &v, const btMatrix3x3 &m)
 
SIMD_FORCE_INLINE btMatrix3x3 operator* (const btMatrix3x3 &m1, const btMatrix3x3 &m2)
 
SIMD_FORCE_INLINE bool operator== (const btMatrix3x3 &m1, const btMatrix3x3 &m2)
 Equality operator between two matrices It will test all elements are equal.
More...
 

Variables

 btMatrix3x3
 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. More...
 

Macro Definition Documentation

◆ btMatrix3x3Data

#define btMatrix3x3Data   btMatrix3x3FloatData

Definition at line 43 of file btMatrix3x3.h.

Function Documentation

◆ absolute()

SIMD_FORCE_INLINE btMatrix3x3 btMatrix3x3::absolute ( ) const

Return the matrix with all values non negative.

Return the matrix with all values non negative.

Definition at line 1028 of file btMatrix3x3.h.

References btFabs(), btMatrix3x3, btVector3, m_floats, x, y, and z.

Referenced by bpy_blend_paths(), closestAxis(), edbm_normals_tools_exec(), float4_to_half4_display(), float_to_half_display(), and furthestAxis().

◆ adjoint()

SIMD_FORCE_INLINE btMatrix3x3 btMatrix3x3::adjoint ( ) const

Return the adjoint of the matrix.

Definition at line 1085 of file btMatrix3x3.h.

References btMatrix3x3, and cofac().

◆ btMatrix3x3() [1/4]

SIMD_FORCE_INLINE btMatrix3x3 ( const btMatrix3x3 &  other)

Copy constructor.

Definition at line 115 of file btMatrix3x3.h.

◆ btMatrix3x3() [2/4]

btMatrix3x3 ( const btQuaternion q)
explicit

Constructor from Quaternion.

Definition at line 61 of file btMatrix3x3.h.

References setRotation().

◆ btMatrix3x3() [3/4]

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.

Definition at line 70 of file btMatrix3x3.h.

References setValue(), and xy.

◆ btMatrix3x3() [4/4]

SIMD_FORCE_INLINE btMatrix3x3 ( const btVector3 v0,
const btVector3 v1,
const btVector3 v2 
)

Definition at line 131 of file btMatrix3x3.h.

References v1, and v2.

◆ cofac()

btScalar cofac ( int  r1,
int  c1,
int  r2,
int  c2 
) const

Calculate the matrix cofactor.

Parameters
r1The first row to use for calculating the cofactor
c1The first column to use for calculating the cofactor
r1The second row to use for calculating the cofactor
c1The second column to use for calculating the cofactor See http://en.wikipedia.org/wiki/Cofactor_(linear_algebra) for more details

Definition at line 801 of file btMatrix3x3.h.

Referenced by adjoint().

◆ deSerialize()

void deSerialize ( const struct btMatrix3x3Data dataIn)

◆ deSerializeDouble()

void deSerializeDouble ( const struct btMatrix3x3DoubleData dataIn)

◆ deSerializeFloat()

void deSerializeFloat ( const struct btMatrix3x3FloatData dataIn)

◆ determinant()

SIMD_FORCE_INLINE btScalar btMatrix3x3::determinant ( ) const

◆ diagonalize()

void diagonalize ( btMatrix3x3 rot,
btScalar  threshold,
int  maxSteps 
)

diagonalizes this matrix by the Jacobi method.

Parameters
rotstores 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.
thresholdSee iteration
iterationThe iteration stops when all off-diagonal elements are less than the threshold multiplied by the sum of the absolute values of the diagonal, or when maxSteps have been executed.

Note that this matrix is assumed to be symmetric.

Definition at line 716 of file btMatrix3x3.h.

References btFabs(), btSqrt(), btVector3, KDL::cos(), max, r, rot, SIMD_EPSILON, KDL::sin(), t, threshold, and v.

◆ extractRotation()

SIMD_FORCE_INLINE 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 decomposes a matrix A in a orthogonal matrix R and a symmetric matrix S: A = R*S. note that R can include both rotation and scaling.

Definition at line 688 of file btMatrix3x3.h.

References A, btFabs(), btMatrix3x3, btVector3, btQuaternion::normalize(), R, and w().

◆ getColumn()

SIMD_FORCE_INLINE btVector3 getColumn ( int  i) const

Get a column of the matrix as a vector.

Parameters
iColumn number 0 indexed

Definition at line 142 of file btMatrix3x3.h.

References btVector3.

Referenced by solve33().

◆ getEulerYPR()

void getEulerYPR ( btScalar yaw,
btScalar pitch,
btScalar roll 
) const

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

Parameters
yawYaw around Y axis
pitchPitch around X axis
rollaround Z axis

Definition at line 526 of file btMatrix3x3.h.

References btAsin(), btAtan2(), btFabs(), SIMD_HALF_PI, SIMD_PI, x, y, and z.

◆ getEulerZYX()

void getEulerZYX ( btScalar yaw,
btScalar pitch,
btScalar roll,
unsigned int  solution_number = 1 
) const

Get the matrix represented as euler angles around ZYX.

Parameters
yawYaw around Z axis
pitchPitch around Y axis
rollaround X axis
solution_numberWhich solution of two possible solutions ( 1 or 2) are possible values

Definition at line 553 of file btMatrix3x3.h.

References btAsin(), btAtan2(), btCos(), btFabs(), SIMD_PI, x, y, and z.

◆ getIdentity()

static const btMatrix3x3& getIdentity ( )
static

◆ getOpenGLSubMatrix()

void getOpenGLSubMatrix ( btScalar m) const

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

Parameters
mThe array to be filled

Definition at line 367 of file btMatrix3x3.h.

References top, v1, v2, x, y, and z.

◆ getRotation()

void getRotation ( btQuaternion q) const

Get the matrix represented as a quaternion.

Parameters
qThe quaternion which will be set

Definition at line 420 of file btMatrix3x3.h.

References btSqrt(), x, y, and z.

◆ getRow()

SIMD_FORCE_INLINE const btVector3& getRow ( int  i) const

Get a row of the matrix as a vector.

Parameters
iRow number 0 indexed

Definition at line 149 of file btMatrix3x3.h.

References btFullAssert.

◆ inverse()

btMatrix3x3 inverse ( ) const

◆ operator*() [1/4]

SIMD_FORCE_INLINE btMatrix3x3 operator* ( const btMatrix3x3 m,
const btScalar k 
)

Definition at line 930 of file btMatrix3x3.h.

References btMatrix3x3, x, y, and z.

◆ operator*() [2/4]

SIMD_FORCE_INLINE btVector3 operator* ( const btMatrix3x3 m,
const btVector3 v 
)

Definition at line 1215 of file btMatrix3x3.h.

References btVector3, blender::math::dot(), and v.

◆ operator*() [3/4]

SIMD_FORCE_INLINE btMatrix3x3 operator* ( const btMatrix3x3 m1,
const btMatrix3x3 m2 
)

Definition at line 1265 of file btMatrix3x3.h.

References btMatrix3x3, v1, and v2.

◆ operator*() [4/4]

SIMD_FORCE_INLINE btVector3 operator* ( const btVector3 v,
const btMatrix3x3 m 
)

Definition at line 1225 of file btMatrix3x3.h.

References btVector3, and v.

◆ operator*=()

btMatrix3x3& operator*= ( const btMatrix3x3 m)

Multiply by the target matrix on the right.

Parameters
mRotation matrix to be applied Equivilant to this = this * m

◆ operator+()

SIMD_FORCE_INLINE btMatrix3x3 operator+ ( const btMatrix3x3 m1,
const btMatrix3x3 m2 
)

Definition at line 952 of file btMatrix3x3.h.

References btMatrix3x3.

◆ operator+=()

btMatrix3x3& operator+= ( const btMatrix3x3 m)

Adds by the target matrix on the right.

Parameters
mmatrix to be applied Equivilant to this = this + m

◆ operator-()

SIMD_FORCE_INLINE btMatrix3x3 operator- ( const btMatrix3x3 m1,
const btMatrix3x3 m2 
)

Definition at line 976 of file btMatrix3x3.h.

References btMatrix3x3.

◆ operator-=()

btMatrix3x3& operator-= ( const btMatrix3x3 m)

Substractss by the target matrix on the right.

Parameters
mmatrix to be applied Equivilant to this = this - m

◆ operator=()

SIMD_FORCE_INLINE btMatrix3x3& operator= ( const btMatrix3x3 other)

Assignment Operator.

Definition at line 123 of file btMatrix3x3.h.

◆ operator==()

SIMD_FORCE_INLINE bool operator== ( const btMatrix3x3 m1,
const btMatrix3x3 m2 
)

Equality operator between two matrices It will test all elements are equal.

Definition at line 1366 of file btMatrix3x3.h.

◆ operator[]()

SIMD_FORCE_INLINE const btVector3 & operator[] ( int  i)

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

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

Parameters
iRow number 0 indexed

Definition at line 157 of file btMatrix3x3.h.

References btFullAssert.

Referenced by ccl_try_align().

◆ scaled()

btMatrix3x3 scaled ( const btVector3 s) const

Create a scaled copy of the matrix.

Parameters
sScaling vector The elements of the vector will scale each column

Definition at line 622 of file btMatrix3x3.h.

References btMatrix3x3, and x.

Referenced by blf_unscaled_F26Dot6_to_pixels(), and gpu_texture_update_from_ibuf().

◆ serialize()

void serialize ( struct btMatrix3x3Data dataOut) const

◆ serializeFloat()

void serializeFloat ( struct btMatrix3x3FloatData dataOut) const

◆ setEulerYPR()

void setEulerYPR ( const btScalar yaw,
const btScalar pitch,
const btScalar roll 
)

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

Parameters
yawYaw about Y axis
pitchPitch about X axis
rollRoll about Z axis

Definition at line 289 of file btMatrix3x3.h.

References setEulerZYX().

◆ setEulerZYX()

void setEulerZYX ( btScalar  eulerX,
btScalar  eulerY,
btScalar  eulerZ 
)

Set the matrix from euler angles YPR around ZYX axes.

Parameters
eulerXRoll about X axis
eulerYPitch around Y axis
eulerZYaw about 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

Todo:
proposed to reverse this since it's labeled zyx but takes arguments xyz and it will match all other parts of the code

Definition at line 303 of file btMatrix3x3.h.

References btCos(), btSin(), setValue(), and sh.

Referenced by setEulerYPR().

◆ setFromOpenGLSubMatrix()

void setFromOpenGLSubMatrix ( const btScalar m)

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

Parameters
mA pointer to the beginning of the array of scalars

Definition at line 188 of file btMatrix3x3.h.

◆ setIdentity()

void setIdentity ( )

Set the matrix to the identity.

Definition at line 323 of file btMatrix3x3.h.

References setValue().

◆ setRotation()

void setRotation ( const btQuaternion q)

Set the matrix from a quaternion.

Parameters
qThe Quaternion to match

Definition at line 215 of file btMatrix3x3.h.

References btFullAssert, btQuaternion::length2(), setValue(), xy, Y, and Z.

Referenced by btMatrix3x3().

◆ setValue()

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)

Parameters
xxTop left
xyTop Middle
xzTop Right
yxMiddle Left
yyMiddle Middle
yzMiddle Right
zxBottom Left
zyBottom Middle
zzBottom Right

Definition at line 204 of file btMatrix3x3.h.

References xy.

Referenced by btMatrix3x3(), btQuaternion::operator*=(), btQuaternion::setEuler(), setEulerZYX(), btQuaternion::setEulerZYX(), setIdentity(), setRotation(), btQuaternion::setRotation(), and setZero().

◆ setZero()

void setZero ( )

◆ solve33()

btVector3 solve33 ( const btVector3 b) const

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 648 of file btMatrix3x3.h.

References usdtokens::b(), btCross(), btDot(), btFabs(), btVector3, getColumn(), SIMD_EPSILON, and x.

◆ tdotx()

SIMD_FORCE_INLINE btScalar tdotx ( const btVector3 v) const

Definition at line 669 of file btMatrix3x3.h.

References v.

◆ tdoty()

SIMD_FORCE_INLINE btScalar tdoty ( const btVector3 v) const

Definition at line 673 of file btMatrix3x3.h.

References v.

◆ tdotz()

SIMD_FORCE_INLINE btScalar tdotz ( const btVector3 v) const

Definition at line 677 of file btMatrix3x3.h.

References v.

◆ timesTranspose()

SIMD_FORCE_INLINE btMatrix3x3 btMatrix3x3::timesTranspose ( const btMatrix3x3 m) const

Definition at line 1162 of file btMatrix3x3.h.

References btMatrix3x3, and blender::math::dot().

◆ transpose()

btMatrix3x3 transpose ( ) const

◆ transposeTimes()

SIMD_FORCE_INLINE btMatrix3x3 btMatrix3x3::transposeTimes ( const btMatrix3x3 m) const

Definition at line 1106 of file btMatrix3x3.h.

References btMatrix3x3, x, y, and z.

Variable Documentation

◆ btMatrix3x3

btMatrix3x3
Initial value:
{
btVector3 m_el[3]
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition: btVector3.h:82

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.

No initializaion constructor.

Definition at line 49 of file btMatrix3x3.h.

Referenced by absolute(), Add(), btDeformableLinearElasticityForce::addScaledDampingForce(), btDeformableNeoHookeanForce::addScaledDampingForce(), btDeformableLinearElasticityForce::addScaledDampingForceDifferential(), btDeformableNeoHookeanForce::addScaledDampingForceDifferential(), btDeformableCorotatedForce::addScaledElasticForce(), btDeformableLinearElasticityForce::addScaledElasticForce(), btDeformableNeoHookeanForce::addScaledElasticForce(), btDeformableLinearElasticityForce::addScaledElasticForceDifferential(), btDeformableNeoHookeanForce::addScaledElasticForceDifferential(), btDeformableLinearElasticityForce::addScaledHessian(), adjoint(), btSoftBody::appendDeformableAnchor(), btClampNormal(), btTransformAabb(), calculateAngleInfo(), btTransformUtil::calculateDiffAxisAngle(), calculatePrincipalAxisTransform(), btConvexPlaneCollisionAlgorithm::collideSingleContact(), compTreeLinkVelocities(), btRigidBody::computeGyroscopicForceExplicit(), btRigidBody::computeGyroscopicImpulseImplicit_Body(), btRigidBody::computeGyroscopicImpulseImplicit_World(), btMultiBodyFixedConstraint::createConstraintRows(), btMultiBodySliderConstraint::createConstraintRows(), btMultiBodySphericalJointMotor::createConstraintRows(), Cross(), btPolarDecomposition::decompose(), Diagonal(), btSoftColliders::CollideSDF_RDF::DoNode(), btSoftColliders::CollideSDF_RS::DoNode(), btSoftColliders::CollideSDF_RD::DoNode(), btSoftBodyHelpers::DrawFrame(), btDeformableLagrangianForce::Ds(), btDeformableLagrangianForce::DsFromVelocity(), btDeformableLinearElasticityForce::elasticEnergyDensity(), evalEulerEqnDeriv(), extractRotation(), GivensRotation::fill(), btDeformableCorotatedForce::firstPiola(), btDeformableLinearElasticityForce::firstPiola(), GIM_TRIANGLE::get_triangle_transform(), getAabb(), getAabbNonVirtual(), getIdentity(), btSoftBody::getRigidTransform(), gim_inertia_add_transformed(), btSoftBody::initializeClusters(), btSoftBody::initializeDmInverse(), btDeformableMultiBodyDynamicsWorld::integrateTransforms(), inverse(), btSoftBody::Body::invWorldInertia(), Lerp(), localFrameToWorld(), MassMatrix(), Mul(), operator*(), operator+(), operator-(), OuterProduct(), outerProduct(), btSoftBody::predictMotion(), btConvexConvexAlgorithm::processCollision(), btDeformableBackwardEulerObjective::reinitialize(), ScaleAlongAxis(), scaled(), singularValueDecomposition(), Sub(), btEigen::system(), timesTranspose(), btSpatialTransformationMatrix::transformInverse(), transposeTimes(), btSoftBody::updateClusters(), btSoftBody::updateDeformation(), btRaycastVehicle::updateFriction(), btSoftBody::updatePose(), and btRaycastVehicle::updateWheelTransform().