Class SBDTypePhysicalMatrix33#
template <typename Quantity>
ClassList > SBDTypePhysicalMatrix33
This template class is used to describe 3x3 physical matrices. More...
#include <SBDTypePhysicalMatrix33.hpp>
Public Attributes#
Type | Name |
---|---|
Quantity | m The components of the physical matrix. |
Public Static Attributes#
Type | Name |
---|---|
const SBDTypePhysicalMatrix33< Quantity > | identity The identity physical matrix. |
const SBDTypePhysicalMatrix33< Quantity > | zero The zero physical matrix. |
Public Functions#
Type | Name |
---|---|
SBDTypePhysicalMatrix33 () Constructs a physical matrix with all components set to zero. |
|
SBDTypePhysicalMatrix33 (const SBDTypePhysicalVector3< Quantity > & d) Constructs the diagonal physical matrix with diagonal [ d.v [0]d.v [1]d.v [2] ]. |
|
SBDTypePhysicalMatrix33 (const SBDTypePhysicalVector3< Quantity > & c0, const SBDTypePhysicalVector3< Quantity > & c1, const SBDTypePhysicalVector3< Quantity > & c2) Constructs the physical matrix with columns c0 ,c1 andc2 . |
|
SBDTypePhysicalMatrix33 (const Quantity & v) Constructs the physical matrix with all components set to v . |
|
SBDTypePhysicalMatrix33 (Quantity mat) Constructs the physical matrix from the quantity array mat . |
|
SBDTypePhysicalMatrix33 (const Quantity & m00, const Quantity & m01, const Quantity & m02, const Quantity & m10, const Quantity & m11, const Quantity & m12, const Quantity & m20, const Quantity & m21, const Quantity & m22) Constructs the physical matrix from components m00 ,m01 ,m02 ,m10 ,m11 ,m12 ,m20 ,m21 andm22 . |
|
SBDTypePhysicalMatrix33 (double d) Constructs the dimensionless physical matrix with all components set to d . |
|
SBDTypePhysicalMatrix33 (double mat) Constructs the dimensionless physical matrix from double array mat . |
|
SBDTypePhysicalMatrix33 (double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22) Constructs the dimensionless physical matrix from components m00 ,m01 ,m02 ,m10 ,m11 ,m12 ,m20 ,m21 andm22 . |
|
SBDTypePhysicalMatrix33 (const SBDTypePhysicalMatrix33< Quantity > & mat) Copy constructor. |
|
void | computeEulerDecompositionZYZ (SBQuantity::dimensionless & phi, SBQuantity::dimensionless & theta, SBQuantity::dimensionless & psi) Computes a ZYZ Euler decomposition of this physical matrix. |
Quantity | cosphi () const Returns the cosine of the rotation angle of this rotation matrix. |
SBQuantityProduct3< Quantity, Quantity, Quantity >::Type | det () const Returns the determinant of this physical matrix. |
void | diagonalize (SBDTypePhysicalVector3< Quantity > & ev, SBDTypePhysicalMatrix33< SBQuantity::dimensionless > & p) Computes the eigenvalues ev and the eigenvectorsp of this physical matrix. |
SBDTypePhysicalVector3< Quantity > | getE1 () const Returns the first column of this physical matrix. |
SBDTypePhysicalVector3< Quantity > | getE2 () const Returns the second column of this physical matrix. |
SBDTypePhysicalVector3< Quantity > | getE3 () const Returns the third column of this physical matrix. |
SBDTypePhysicalMatrix33< SBQuantity::dimensionless > | getValue () const Returns a dimensionless physical matrix whose components are equal to those of this physical matrix. |
SBDTypePhysicalMatrix33< typename SBQuantityInverse< Quantity >::Type > | inverse () const Returns the inverse of this physical matrix. |
void | makeEulerRotationZYZ (const SBQuantity::dimensionless & phi, const SBQuantity::dimensionless & theta, const SBQuantity::dimensionless & psi) This function sets this physical matrix from ZYZ Euler angles phi ,theta andpsi . |
Quantity | norm () const Returns the 2-norm of this physical matrix. |
bool | operator!= (const SBDTypePhysicalMatrix33< Quantity > & mat) const Returns true if this physical matrix is different from physical matrix mat (component-wise) |
SBDTypePhysicalMatrix33< typename SBQuantityProduct2< Quantity, QuantityB >::Type > | operator* (const SBDTypePhysicalMatrix33< QuantityB > & mat) const Returns the product of this physical matrix with physical matrix mat . |
SBDTypePhysicalMatrix33< Quantity > | operator* (double d) const Returns the product of this physical matrix with double d . |
SBDTypePhysicalVector3< typename SBQuantityProduct2< Quantity, QuantityB >::Type > | operator* (const SBDTypePhysicalVector3< QuantityB > & v) const Returns the product of this physical matrix with physical vector v . |
SBDTypePhysicalMatrix33< Quantity > & | operator*= (QuantityB d) Multiplies this physical matrix with physical quantity d . |
SBDTypePhysicalMatrix33< Quantity > | operator+ (const SBDTypePhysicalMatrix33< Quantity > & mat) const Returns the sum of this physical matrix with physical matrix mat . |
void | operator+= (const SBDTypePhysicalMatrix33< Quantity > & mat) Adds physical matrix mat to this physical matrix. |
SBDTypePhysicalMatrix33< Quantity > | operator- (const SBDTypePhysicalMatrix33< Quantity > & mat) const Returns the difference of this physical matrix with physical matrix mat . |
SBDTypePhysicalMatrix33< Quantity > | operator- () const Returns the opposite of this physical matrix. |
void | operator-= (const SBDTypePhysicalMatrix33< Quantity > & mat) Subtracts physical matrix mat from this physical matrix. |
SBDTypePhysicalMatrix33< Quantity > | operator/ (double d) const Returns the division of this physical matrix by double d . |
SBDTypePhysicalMatrix33< Quantity > & | operator/= (QuantityB d) Divides this physical matrix by physical quantity d . |
SBDTypePhysicalMatrix33< Quantity > & | operator= (const SBDTypePhysicalMatrix33< Quantity > & mat) Copy assignment. |
bool | operator== (const SBDTypePhysicalMatrix33< Quantity > & mat) const Returns true if this physical matrix is equal to physical matrix mat (component-wise) |
void | orthonormalize () Orthonormalizes this dimensionless physical matrix. |
void | print () const Prints this physical matrix. |
void | quasiStaticUpdate (const SBQuantity::dimensionless & wx, const SBQuantity::dimensionless & wy, const SBQuantity::dimensionless & wz, SBQuantity::dimensionless & rotAngle, SBVector3 & rotAxis, SBDTypePhysicalMatrix33< Quantity > & rotA, SBDTypePhysicalMatrix33< Quantity > & rotB, SBDTypePhysicalMatrix33< Quantity > & rotC) Performs a quasi-static update of this dimensionless physical matrix using the rotation vector [ wx wy wz ]. |
void | revoluteJointZAxisMatrix (const SBVector3 & axis) Sets this physical matrix to an orthonormal matrix whose third column is axis . |
void | serialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER) const Serializes the physical matrix using the provided serializer . |
void | setE1 (const SBDTypePhysicalVector3< Quantity > & v) Sets the first column of this physical matrix. |
void | setE2 (const SBDTypePhysicalVector3< Quantity > & v) Sets the second column of this physical matrix. |
void | setE3 (const SBDTypePhysicalVector3< Quantity > & v) Sets the third column of this physical matrix. |
void | setIdentity () Sets this physical matrix to the identity matrix. |
void | setValue (const SBDTypePhysicalMatrix33< SBQuantity::dimensionless > & u) Sets the components of this physical matrix equal to those of the dimensionless physical matrix u . |
void | setZero () Sets this physical matrix to zero. |
void | swapColumns (unsigned int i, unsigned int j) Swaps columns i andj . |
void | swapRows (unsigned int i, unsigned int j) Swaps rows i andj . |
void | toQuaternion (SBQuantity::dimensionless & w, SBQuantity::dimensionless & x, SBQuantity::dimensionless & y, SBQuantity::dimensionless & z) const Computes the quaternion [ w x y __z ] corresponding to this physical matrix. |
void | toRotationVector (SBVector3 & rotationVector) const Computes the rotation vector corresponding to this dimensionless physical matrix. |
Quantity | trace () const Returns the trace m[0][0] + m[1][1] + m[2][2] of this physical matrix. |
SBDTypePhysicalMatrix33< Quantity > | transpose () const Returns the transpose of this physical matrix. |
void | unserialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER) Unserializes the physical matrix using the provided serializer . |
Public Static Functions#
Type | Name |
---|---|
SBDTypePhysicalMatrix33< SBQuantity::dimensionless > | fromAlignment (const SBVector3 & from, const SBVector3 & to) Returns the dimensionless physical matrix that transforms vector from into vectorto . Precisely, left-multiplying vectorfrom by the resulting matrix produces vectorto . |
SBDTypePhysicalMatrix33< SBQuantity::dimensionless > | fromAxisAngle (const SBVector3 & axis, const SBQuantity::dimensionless & angle) Returns the dimensionless physical matrix corresponding to rotation axis axis and rotation angleangle (in radians) |
SBDTypePhysicalMatrix33< SBQuantity::dimensionless > | fromAxisAnglePi (const SBVector3 & axis) Returns the dimensionless physical matrix corresponding to rotation axis axis and a rotation angle equal to Pi. |
SBDTypePhysicalMatrix33< SBQuantity::dimensionless > | fromQuaternion (const SBQuantity::dimensionless & w, const SBQuantity::dimensionless & x, const SBQuantity::dimensionless & y, const SBQuantity::dimensionless & z) Returns the dimensionless physical matrix corresponding to quaternion [ w x y __z ]. |
Detailed Description#
Template parameters:
Quantity
The quantity type of the physical matrix
This template class describes 3x3 physical matrices.
Physical matrices are physical quantities, and thus use SAMSON's unit system. In a physical matrix (e.g. an inertia tensor), all components have the same unit, so that physical matrices are defined by only one unit, and the SBDTypePhysicalMatrix33 template class is parameterized by only one type: Quantity
.
Most of the time, developers of SAMSON Extensions do not have to use this template, but may directly use some predefined types that correspond to specific instantiations of this template class, e.g. SBMatrix33 (dimensionless matrix), SBMass33 (mass matrix), SBInertiaTensor33 (inertia tensor), etc.
Dimensionless 3x3 matrices (SBMatrix33) are especially useful since they are used to represent 3D reference frames, rotation matrices, rigid-body transforms, etc.
Short name: SBPhysicalMatrix33
See also: SBDTypePhysicalVector3, SBDTypeSpatialTransform
See also: SAMSON's unit system
Public Attributes Documentation#
variable m#
The components of the physical matrix.
Public Static Attributes Documentation#
variable identity#
The identity physical matrix.
variable zero#
The zero physical matrix.
Public Functions Documentation#
function SBDTypePhysicalMatrix33 [1/10]#
Constructs a physical matrix with all components set to zero.
function SBDTypePhysicalMatrix33 [2/10]#
Constructs the diagonal physical matrix with diagonal [ d.v
[0]d.v
[1]d.v
[2] ].
inline SBDTypePhysicalMatrix33::SBDTypePhysicalMatrix33 (
const SBDTypePhysicalVector3 < Quantity > & d
)
function SBDTypePhysicalMatrix33 [3/10]#
Constructs the physical matrix with columns c0
,c1
andc2
.
inline SBDTypePhysicalMatrix33::SBDTypePhysicalMatrix33 (
const SBDTypePhysicalVector3 < Quantity > & c0,
const SBDTypePhysicalVector3 < Quantity > & c1,
const SBDTypePhysicalVector3 < Quantity > & c2
)
function SBDTypePhysicalMatrix33 [4/10]#
Constructs the physical matrix with all components set to v
.
function SBDTypePhysicalMatrix33 [5/10]#
Constructs the physical matrix from the quantity array mat
.
function SBDTypePhysicalMatrix33 [6/10]#
Constructs the physical matrix from components m00
,m01
,m02
,m10
,m11
,m12
,m20
,m21
andm22
.
inline SBDTypePhysicalMatrix33::SBDTypePhysicalMatrix33 (
const Quantity & m00,
const Quantity & m01,
const Quantity & m02,
const Quantity & m10,
const Quantity & m11,
const Quantity & m12,
const Quantity & m20,
const Quantity & m21,
const Quantity & m22
)
function SBDTypePhysicalMatrix33 [7/10]#
Constructs the dimensionless physical matrix with all components set to d
.
function SBDTypePhysicalMatrix33 [8/10]#
Constructs the dimensionless physical matrix from double array mat
.
function SBDTypePhysicalMatrix33 [9/10]#
Constructs the dimensionless physical matrix from components m00
,m01
,m02
,m10
,m11
,m12
,m20
,m21
andm22
.
inline SBDTypePhysicalMatrix33::SBDTypePhysicalMatrix33 (
double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22
)
function SBDTypePhysicalMatrix33 [10/10]#
Copy constructor.
inline SBDTypePhysicalMatrix33::SBDTypePhysicalMatrix33 (
const SBDTypePhysicalMatrix33 < Quantity > & mat
)
function computeEulerDecompositionZYZ#
Computes a ZYZ Euler decomposition of this physical matrix.
inline void SBDTypePhysicalMatrix33::computeEulerDecompositionZYZ (
SBQuantity::dimensionless & phi,
SBQuantity::dimensionless & theta,
SBQuantity::dimensionless & psi
)
Parameters:
phi
The first Z rotation angletheta
The Y rotation anglepsi
The second Z rotation angle
This function computes a ZYZ Euler decomposition of this physical matrix:
where denotes this physical matrix, denotes the first rotation around the Z axis, denotes the rotation around the Y axis, and denotes the second rotation around the Z axis.
Note that this function may only be used with dimensionless physical matrices.
function cosphi#
Returns the cosine of the rotation angle of this rotation matrix.
This function assumes this physical matrix is a rotation matrix, and returns the cosine of the corresponding rotation angle
function det#
Returns the determinant of this physical matrix.
inline SBQuantityProduct3< Quantity, Quantity, Quantity >::Type SBDTypePhysicalMatrix33::det () const
function diagonalize#
Computes the eigenvalues ev
and the eigenvectorsp
of this physical matrix.
inline void SBDTypePhysicalMatrix33::diagonalize (
SBDTypePhysicalVector3 < Quantity > & ev,
SBDTypePhysicalMatrix33 < SBQuantity::dimensionless > & p
)
Parameters:
ev
Stores the eigenvalues when this function returnsp
Stores the eigenvectors when this function returns
This function computes the eigenvalues ev
and the eigenvectors p
of this physical matrix. Note that the eigenvalues have the same units as the physical matrix, while the eigenvectors are stored in a dimensionless matrix.
See also: SAMSON's unit system
function getE1#
Returns the first column of this physical matrix.
function getE2#
Returns the second column of this physical matrix.
function getE3#
Returns the third column of this physical matrix.
function getValue#
Returns a dimensionless physical matrix whose components are equal to those of this physical matrix.
inline SBDTypePhysicalMatrix33 < SBQuantity::dimensionless > SBDTypePhysicalMatrix33::getValue () const
function inverse#
Returns the inverse of this physical matrix.
inline SBDTypePhysicalMatrix33 < typename SBQuantityInverse< Quantity >::Type > SBDTypePhysicalMatrix33::inverse () const
This function assumes the physical matrix is invertible and returns its inverse.
function makeEulerRotationZYZ#
This function sets this physical matrix from ZYZ Euler angles phi
,theta
andpsi
.
inline void SBDTypePhysicalMatrix33::makeEulerRotationZYZ (
const SBQuantity::dimensionless & phi,
const SBQuantity::dimensionless & theta,
const SBQuantity::dimensionless & psi
)
Parameters:
phi
The first Z rotation angletheta
The Y rotation anglepsi
The second Z rotation angle
This function sets this physical matrix from ZYZ Euler angles:
where denotes this physical matrix, denotes the first rotation around the Z axis, denotes the rotation around the Y axis, and denotes the second rotation around the Z axis.
Note that this function may only be used with dimensionless physical matrices.
function norm#
Returns the 2-norm of this physical matrix.
function operator!=#
Returns true if this physical matrix is different from physical matrix mat
(component-wise)
inline bool SBDTypePhysicalMatrix33::operator!= (
const SBDTypePhysicalMatrix33 < Quantity > & mat
) const
function operator*#
Returns the product of this physical matrix with physical matrix mat
.
template<typename QuantityB>
inline SBDTypePhysicalMatrix33 < typename SBQuantityProduct2< Quantity, QuantityB >::Type > SBDTypePhysicalMatrix33::operator* (
const SBDTypePhysicalMatrix33 < QuantityB > & mat
) const
function operator*#
Returns the product of this physical matrix with double d
.
function operator*#
Returns the product of this physical matrix with physical vector v
.
template<typename QuantityB>
inline SBDTypePhysicalVector3 < typename SBQuantityProduct2< Quantity, QuantityB >::Type > SBDTypePhysicalMatrix33::operator* (
const SBDTypePhysicalVector3 < QuantityB > & v
) const
function operator*=#
Multiplies this physical matrix with physical quantity d
.
template<typename QuantityB>
inline SBDTypePhysicalMatrix33 < Quantity > & SBDTypePhysicalMatrix33::operator*= (
QuantityB d
)
Parameters:
d
A dimensionless physical quantity or a numeric type (i.e. int, float, double, etc)
function operator+#
Returns the sum of this physical matrix with physical matrix mat
.
inline SBDTypePhysicalMatrix33 < Quantity > SBDTypePhysicalMatrix33::operator+ (
const SBDTypePhysicalMatrix33 < Quantity > & mat
) const
function operator+=#
Adds physical matrix mat
to this physical matrix.
inline void SBDTypePhysicalMatrix33::operator+= (
const SBDTypePhysicalMatrix33 < Quantity > & mat
)
function operator-#
Returns the difference of this physical matrix with physical matrix mat
.
inline SBDTypePhysicalMatrix33 < Quantity > SBDTypePhysicalMatrix33::operator- (
const SBDTypePhysicalMatrix33 < Quantity > & mat
) const
function operator-#
Returns the opposite of this physical matrix.
function operator-=#
Subtracts physical matrix mat
from this physical matrix.
inline void SBDTypePhysicalMatrix33::operator-= (
const SBDTypePhysicalMatrix33 < Quantity > & mat
)
function operator/#
Returns the division of this physical matrix by double d
.
function operator/=#
Divides this physical matrix by physical quantity d
.
template<typename QuantityB>
inline SBDTypePhysicalMatrix33 < Quantity > & SBDTypePhysicalMatrix33::operator/= (
QuantityB d
)
Parameters:
d
A dimensionless physical quantity or a numeric type (i.e. int, float, double, etc)
function operator=#
Copy assignment.
inline SBDTypePhysicalMatrix33 < Quantity > & SBDTypePhysicalMatrix33::operator= (
const SBDTypePhysicalMatrix33 < Quantity > & mat
)
function operator==#
Returns true if this physical matrix is equal to physical matrix mat
(component-wise)
inline bool SBDTypePhysicalMatrix33::operator== (
const SBDTypePhysicalMatrix33 < Quantity > & mat
) const
function orthonormalize#
Orthonormalizes this dimensionless physical matrix.
function print#
Prints this physical matrix.
function quasiStaticUpdate#
Performs a quasi-static update of this dimensionless physical matrix using the rotation vector [ wx
wy
wz
].
inline void SBDTypePhysicalMatrix33::quasiStaticUpdate (
const SBQuantity::dimensionless & wx,
const SBQuantity::dimensionless & wy,
const SBQuantity::dimensionless & wz,
SBQuantity::dimensionless & rotAngle,
SBVector3 & rotAxis,
SBDTypePhysicalMatrix33 < Quantity > & rotA,
SBDTypePhysicalMatrix33 < Quantity > & rotB,
SBDTypePhysicalMatrix33 < Quantity > & rotC
)
Parameters:
wx
The first component of the rotation vectorwy
The second component of the rotation vectorwz
The third component of the rotation vectorrotAngle
The rotation anglerotAxis
The rotation axisrotA
The rotation axisrotB
The rotation axisrotC
The rotation axis
This function performs a quasi-static update of this dimensionless physical matrix using the rotation vector [ wx
wy
wz
]. During the update, The rotation vector [ wx
wy
wz
] is converted to a rotation angle and rotation axis, respectively stored into rotAngle
and rotAxis
. If denotes the original matrix, the final matrix is , where , and are physical matrices computed from and the rotation axis , and is the rotation angle:
where is the matrix such that for any .
When the function returns, , and are stored into rotA
, rotB
and rotC
, respectively.
Note that this function may only be used with dimensionless physical matrices.
function revoluteJointZAxisMatrix#
Sets this physical matrix to an orthonormal matrix whose third column is axis
.
function serialize#
Serializes the physical matrix using the provided serializer
.
inline void SBDTypePhysicalMatrix33::serialize (
SBCSerializer * serializer,
const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
) const
function setE1#
Sets the first column of this physical matrix.
function setE2#
Sets the second column of this physical matrix.
function setE3#
Sets the third column of this physical matrix.
function setIdentity#
Sets this physical matrix to the identity matrix.
function setValue#
Sets the components of this physical matrix equal to those of the dimensionless physical matrix u
.
inline void SBDTypePhysicalMatrix33::setValue (
const SBDTypePhysicalMatrix33 < SBQuantity::dimensionless > & u
)
function setZero#
Sets this physical matrix to zero.
function swapColumns#
Swaps columns i
andj
.
function swapRows#
Swaps rows i
andj
.
function toQuaternion#
Computes the quaternion [ w
x
y
__z
] corresponding to this physical matrix.
inline void SBDTypePhysicalMatrix33::toQuaternion (
SBQuantity::dimensionless & w,
SBQuantity::dimensionless & x,
SBQuantity::dimensionless & y,
SBQuantity::dimensionless & z
) const
function toRotationVector#
Computes the rotation vector corresponding to this dimensionless physical matrix.
function trace#
Returns the trace m[0][0] + m[1][1] + m[2][2] of this physical matrix.
function transpose#
Returns the transpose of this physical matrix.
function unserialize#
Unserializes the physical matrix using the provided serializer
.
inline void SBDTypePhysicalMatrix33::unserialize (
SBCSerializer * serializer,
const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
)
Public Static Functions Documentation#
function fromAlignment#
Returns the dimensionless physical matrix that transforms vector from
into vectorto
. Precisely, left-multiplying vectorfrom
by the resulting matrix produces vectorto
.
static inline SBDTypePhysicalMatrix33 < SBQuantity::dimensionless > SBDTypePhysicalMatrix33::fromAlignment (
const SBVector3 & from,
const SBVector3 & to
)
function fromAxisAngle#
Returns the dimensionless physical matrix corresponding to rotation axis axis
and rotation angleangle
(in radians)
static inline SBDTypePhysicalMatrix33 < SBQuantity::dimensionless > SBDTypePhysicalMatrix33::fromAxisAngle (
const SBVector3 & axis,
const SBQuantity::dimensionless & angle
)
function fromAxisAnglePi#
Returns the dimensionless physical matrix corresponding to rotation axis axis
and a rotation angle equal to Pi.
static inline SBDTypePhysicalMatrix33 < SBQuantity::dimensionless > SBDTypePhysicalMatrix33::fromAxisAnglePi (
const SBVector3 & axis
)
function fromQuaternion#
Returns the dimensionless physical matrix corresponding to quaternion [ w
x
y
__z
].
static inline SBDTypePhysicalMatrix33 < SBQuantity::dimensionless > SBDTypePhysicalMatrix33::fromQuaternion (
const SBQuantity::dimensionless & w,
const SBQuantity::dimensionless & x,
const SBQuantity::dimensionless & y,
const SBQuantity::dimensionless & z
)