From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/classNLMISC_1_1CMatrix.html | 2979 ++++++++++++++++++++++++++ 1 file changed, 2979 insertions(+) create mode 100644 docs/doxygen/nel/classNLMISC_1_1CMatrix.html (limited to 'docs/doxygen/nel/classNLMISC_1_1CMatrix.html') diff --git a/docs/doxygen/nel/classNLMISC_1_1CMatrix.html b/docs/doxygen/nel/classNLMISC_1_1CMatrix.html new file mode 100644 index 00000000..dccb58fe --- /dev/null +++ b/docs/doxygen/nel/classNLMISC_1_1CMatrix.html @@ -0,0 +1,2979 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

NLMISC::CMatrix Class Reference

A 4*4 Homogenous Matrix. +More... +

+#include <matrix.h> +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

enum  TRotOrder {
+  XYZ, +XZY, +YXZ, +YZX, +
+  ZXY, +ZYX +
+ }
 Rotation Order. More...


Public Methods

Object
 CMatrix ()
 Constructor which init to identity(). More...

 CMatrix (const CMatrix &)
 Copy Constructor. More...

CMatrix & operator= (const CMatrix &)
 operator=. More...

Sets
void identity ()
 Reset the matrix to identity. More...

void setRot (const CVector &i, const CVector &j, const CVector &k, bool hintNoScale=false)
 Explicit setup the Rotation/Scale matrix (base). More...

void setRot (const float m33[9], bool hintNoScale=false)
 Explicit setup the Rotation/Scale matrix (base). More...

void setRot (const CVector &v, TRotOrder ro)
 Explicit setup the Rotation matrix (base) as a Euler rotation matrix. More...

void setRot (const CQuat &quat)
 Explicit setup the Rotation matrix (base) as a Quaternion rotation matrix. More...

void setRot (const CMatrix &matrix)
 Explicit setup the Rotation/Scale matrix (base) with the rotation part of an other matrix. More...

void setPos (const CVector &v)
 Explicit setup the Translation component. More...

void movePos (const CVector &v)
 Explicit move the Translation component. More...

void setProj (const float proj[4])
 Explicit setup the Projection component. More...

void resetProj ()
 Reset the Projection component to 0 0 0 1. More...

void set (const float m44[16])
 Explicit setup the 4*4 matrix. More...

Gets.
void getRot (CVector &i, CVector &j, CVector &k) const
 Get the Rotation/Scale matrix (base). More...

void getRot (float m33[9]) const
 Get the Rotation/Scale matrix (base). More...

void getRot (CQuat &quat) const
 Get the Rotation matrix (base). More...

CQuat getRot () const
 Get the Rotation matrix (base). More...

void getPos (CVector &v) const
 Get the Translation component. More...

const CVectorgetPos () const
 Get the Translation component. More...

void getProj (float proj[4]) const
 Get the Projection component. More...

CVector getI () const
 Get the I vector of the Rotation/Scale matrix (base). More...

CVector getJ () const
 Get the J vector of the Rotation/Scale matrix (base). More...

CVector getK () const
 Get the K vector of the Rotation/Scale matrix (base). More...

void get (float m44[16]) const
 Get 4*4 matrix. More...

const float * get () const
 Get 4*4 matrix. More...

3D Operations.
void translate (const CVector &v)
 Apply a translation to the matrix. same as M=M*T. More...

void rotateX (float a)
 Apply a rotation on axis X to the matrix. More...

void rotateY (float a)
 Apply a rotation on axis Y to the matrix. More...

void rotateZ (float a)
 Apply a rotation on axis Z to the matrix. More...

void rotate (const CVector &v, TRotOrder ro)
 Apply a euler rotation. More...

void rotate (const CQuat &quat)
 Apply a quaternion rotation. More...

void scale (float f)
 Apply a uniform scale to the matrix. More...

void scale (const CVector &scale)
 Apply a non-uniform scale to the matrix. More...

Matrix Operations.
void setMulMatrix (const CMatrix &m1, const CMatrix &m2)
 Matrix multiplication. More...

CMatrix operator * (const CMatrix &in) const
 Matrix multiplication. More...

CMatrix & operator *= (const CMatrix &in)
 equivalent to M=M*in. More...

void setMulMatrixNoProj (const CMatrix &m1, const CMatrix &m2)
 Matrix multiplication assuming no projection at all in m1/m2 and Hence this. More...

void transpose3x3 ()
 transpose the rotation part only of the matrix (swap columns/lines). More...

void transpose ()
 transpose the matrix (swap columns/lines). More...

void invert ()
 Invert the matrix. More...

CMatrix inverted () const
 Return the matrix inverted. More...

bool normalize (TRotOrder pref)
 Normalize the matrix so that the rotation part is now an orthonormal basis, ie a rotation with no scale. More...

CVector mulVector (const CVector &v) const
 Multiply a normal. ie v.w=0 so the Translation component doesn't affect result. Projection doesn't affect result. More...

CVector mulPoint (const CVector &v) const
 Multiply a point. ie v.w=1 so the Translation component do affect result. Projection doesn't affect result. More...

CVector operator * (const CVector &v) const
 Multiply a point.
+See also:
+mulPoint.
More...


CVectorH operator * (const CVectorH &v) const
 Multiply with an homogenous vector. More...

Misc
void serial (IStream &f)
bool hasScalePart () const
 return true if the matrix has a scale part (by scale(), by multiplication etc...). More...

bool hasScaleUniform () const
 return true if hasScalePart() and if if this scale is uniform. More...

float getScaleUniform () const
 return true the uniform scale. valid only if hasScaleUniform() is true, else 1 is returned. More...

bool hasProjectionPart () const
 return true if the matrix has a projection part (by setProj(), by multiplication etc...). More...


Static Public Attributes

const CMatrix Identity
 The identity matrix. Same as CMatrix(). More...


Private Methods

void fastInvert33 (CMatrix &ret) const
bool slowInvert33 (CMatrix &ret) const
bool slowInvert44 (CMatrix &ret) const
float & mat (sint i, sint j)
const float & mat (sint i, sint j) const
void getCofactIndex (sint i, sint &l1, sint &l2, sint &l3) const
bool hasTrans () const
bool hasRot () const
bool hasProj () const
bool hasAll () const
void testExpandRot () const
void testExpandProj () const

Private Attributes

float M [16]
float Scale33
uint32 StateBit

Friends

CPlane operator * (const CPlane &p, const CMatrix &m)
 Plane (line vector) multiplication. More...

+


Detailed Description

+A 4*4 Homogenous Matrix. +

+This is a column matrix, so operations like: v1=A*B*C*v0; applies C first , then B, then A to vector v0.
+ Since it is a column matrix, the first column is the I vector of the base, 2nd is J, 3th is K.
+ 4th column vector is T, the translation vector. +

+Angle orientation are: Xaxis: YtoZ. Yaxis: ZtoX. Zaxis: XtoY. +

+This matrix keep a matrix state to improve Matrix, vector and plane computing (matrix inversion, vector multiplication...). The internal matrix know if:

    +
  • matrix is identity
  • matrix has a translation component
  • matrix has a rotation component
  • matrix has a uniform scale component (scale which is the same along the 3 axis)
  • matrix has a non-uniform scale component
  • matrix has a projection component (4th line of the matrix is not 0 0 0 1).
+An example of improvement is that CMatrix::operator *(const CVector &v) return v if the matrix is identity. +

+By default, a matrix is identity. But for a performance view, this is just a StateBit=0...

+Author:
+Lionel Berenguier , Nevrax France
+Date:
+2000
+

+ +

+Definition at line 66 of file matrix.h.


Member Enumeration Documentation

+

+ + + + +
+ + +
enum NLMISC::CMatrix::TRotOrder +
+
+ + + + + +
+   + + +

+Rotation Order. +

+

+Enumeration values:
+ + + + + + + +
XYZ  +
XZY  +
YXZ  +
YZX  +
ZXY  +
ZYX  +
+
+ +

+Definition at line 70 of file matrix.h.

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLMISC::CMatrix::CMatrix   [inline]
+
+ + + + + +
+   + + +

+Constructor which init to identity(). +

+ +

+Definition at line 88 of file matrix.h. +

+References M, and StateBit. +

+Referenced by getRot, inverted, operator *, operator *=, rotate, setMulMatrix, setMulMatrixNoProj, setRot, testExpandProj, and testExpandRot.

+

+ + + + +
+ + + + + + + + + + +
NLMISC::CMatrix::CMatrix const CMatrix &  
+
+ + + + + +
+   + + +

+Copy Constructor. +

+ +

+Definition at line 163 of file matrix.cpp.

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::fastInvert33 CMatrix &   ret const [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1046 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, MAT_SCALEUNI, s, Scale33, and StateBit. +

+Referenced by inverted.

+

+ + + + +
+ + + + + + + + + +
const float * NLMISC::CMatrix::get   const
+
+ + + + + +
+   + + +

+Get 4*4 matrix. +

+

+Returns:
+the matrix's 4*4 column matrix (4x4 matrix stored in column-major order as 16 consecutive values)
+

+Definition at line 451 of file matrix.cpp. +

+References M, testExpandProj, and testExpandRot.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::get float   m44[16] const
+
+ + + + + +
+   + + +

+Get 4*4 matrix. +

+

+Parameters:
+ + +
m44  +the matrix's 4*4 column matrix (4x4 matrix stored in column-major order as 16 consecutive values)
+
+

+Definition at line 443 of file matrix.cpp. +

+References M, testExpandProj, and testExpandRot.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLMISC::CMatrix::getCofactIndex sint   i,
sint  l1,
sint  l2,
sint  l3
const [inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 362 of file matrix.h. +

+Referenced by slowInvert44.

+

+ + + + +
+ + + + + + + + + +
CVector NLMISC::CMatrix::getI   const
+
+ + + + + +
+   + + +

+Get the I vector of the Rotation/Scale matrix (base). +

+ +

+Definition at line 419 of file matrix.cpp. +

+References a11, a21, a31, and hasRot. +

+Referenced by NL3D::CPlaneBasis::CPlaneBasis, NL3D::CMaterial::decompUserTexMat, NL3D::CPSUtil::displayBasis, NL3D::CZoneLighter::light, normalize, NL3D::CQuadTree::selectSegment, slowInvert33, NL3D::CWaterRenderObs::traverse, and NL3D::CSpinnerFunctor::updateSamples.

+

+ + + + +
+ + + + + + + + + +
CVector NLMISC::CMatrix::getJ   const
+
+ + + + + +
+   + + +

+Get the J vector of the Rotation/Scale matrix (base). +

+ +

+Definition at line 427 of file matrix.cpp. +

+References a12, a22, a32, and hasRot. +

+Referenced by NL3D::CPlaneBasis::CPlaneBasis, NL3D::CMaterial::decompUserTexMat, NL3D::CPSUtil::displayBasis, NL3D::CParticleSystem::getLOD, NL3D::CParticleSystem::getLODVect, NL3D::CZoneLighter::light, normalize, NL3D::CQuadTree::selectRay, NL3D::CQuadTree::selectSegment, slowInvert33, NL3D::CWaterRenderObs::traverse, and NL3D::CSpinnerFunctor::updateSamples.

+

+ + + + +
+ + + + + + + + + +
CVector NLMISC::CMatrix::getK   const
+
+ + + + + +
+   + + +

+Get the K vector of the Rotation/Scale matrix (base). +

+ +

+Definition at line 435 of file matrix.cpp. +

+References a13, a23, a33, and hasRot. +

+Referenced by NL3D::CPSUtil::displayBasis, normalize, NL3D::CQuadTree::selectRay, NL3D::CQuadTree::selectSegment, slowInvert33, and NL3D::CWaterRenderObs::traverse.

+

+ + + + +
+ + + + + + + + + +
const CVector& NLMISC::CMatrix::getPos   const [inline]
+
+ + + + + +
+   + + +

+Get the Translation component. +

+NB: a const & works because it is a column vector

+Returns:
+the matrix's translation vector.
+

+Definition at line 193 of file matrix.h. +

+References M.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::getPos CVector  v const [inline]
+
+ + + + + +
+   + + +

+Get the Translation component. +

+

+Parameters:
+ + +
v  +the matrix's translation vector.
+
+

+Definition at line 188 of file matrix.h. +

+References M, and v. +

+Referenced by NL3D::CVegetableManager::addInstance, NL3D::CMaterial::decompUserTexMat, NL3D::CPSUtil::displayBasis, NL3D::CVegetable::generateInstance, NL3D::CParticleSystem::getLOD, NL3D::CParticleSystem::getLODVect, NLPACS::UMoveContainer::getPACSCoordsFromMatrix, NL3D::CParticleSystem::setNumTris, NL3D::CParticleSystem::setSysMat, NL3D::CWaterRenderObs::traverse, NL3D::ITravCameraScene::update, and NL3D::CParticleSystem::updateLODRatio.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::getProj float   proj[4] const
+
+ + + + + +
+   + + +

+Get the Projection component. +

+

+Parameters:
+ + +
proj  +the matrix's projection vector.
+
+

+Definition at line 401 of file matrix.cpp. +

+References a41, a42, a43, a44, and hasProj.

+

+ + + + +
+ + + + + + + + + +
CQuat NLMISC::CMatrix::getRot   const [inline]
+
+ + + + + +
+   + + +

+Get the Rotation matrix (base). +

+

+Parameters:
+ + +
quat  +the return quaternion.
+
+

+Definition at line 184 of file matrix.h.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::getRot CQuat  quat const
+
+ + + + + +
+   + + +

+Get the Rotation matrix (base). +

+

+Parameters:
+ + +
quat  +the return quaternion.
+
+

+Definition at line 1463 of file matrix.cpp. +

+References CMatrix, MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, q, s, StateBit, and ZYX.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::getRot float   m33[9] const
+
+ + + + + +
+   + + +

+Get the Rotation/Scale matrix (base). +

+

+Parameters:
+ + +
m33  +the matrix's 3*3 column rotation matrix. (3x3 matrix stored in column-major order as 9 consecutive values)
+
+

+Definition at line 369 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, and hasRot.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NLMISC::CMatrix::getRot CVector  i,
CVector  j,
CVector  k
const
+
+ + + + + +
+   + + +

+Get the Rotation/Scale matrix (base). +

+

+Parameters:
+ + + + +
i  +The matrix's I vector of the cartesian base.
j  +The matrix's J vector of the cartesian base.
k  +The matrix's K vector of the cartesian base.
+
+

+Definition at line 353 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, and hasRot.

+

+ + + + +
+ + + + + + + + + +
float NLMISC::CMatrix::getScaleUniform   const
+
+ + + + + +
+   + + +

+return true the uniform scale. valid only if hasScaleUniform() is true, else 1 is returned. +

+ +

+Definition at line 106 of file matrix.cpp. +

+References hasScaleUniform, and Scale33.

+

+ + + + +
+ + + + + + + + + +
bool NLMISC::CMatrix::hasAll   const [inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 129 of file matrix.cpp. +

+References hasProj, hasRot, and hasTrans. +

+Referenced by operator=.

+

+ + + + +
+ + + + + + + + + +
bool NLMISC::CMatrix::hasProj   const [inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 125 of file matrix.cpp. +

+References MAT_PROJ, and StateBit. +

+Referenced by getProj, hasAll, operator=, rotateX, rotateY, rotateZ, scale, serial, testExpandProj, translate, and transpose.

+

+ + + + +
+ + + + + + + + + +
bool NLMISC::CMatrix::hasProjectionPart   const
+
+ + + + + +
+   + + +

+return true if the matrix has a projection part (by setProj(), by multiplication etc...). +

+ +

+Definition at line 96 of file matrix.cpp. +

+References MAT_PROJ, and StateBit.

+

+ + + + +
+ + + + + + + + + +
bool NLMISC::CMatrix::hasRot   const [inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 117 of file matrix.cpp. +

+References MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, and StateBit. +

+Referenced by getI, getJ, getK, getRot, hasAll, mulPoint, mulVector, operator=, rotateX, rotateY, serial, setRot, testExpandRot, translate, and transpose3x3.

+

+ + + + +
+ + + + + + + + + +
bool NLMISC::CMatrix::hasScalePart   const
+
+ + + + + +
+   + + +

+return true if the matrix has a scale part (by scale(), by multiplication etc...). +

+ +

+Definition at line 92 of file matrix.cpp. +

+References MAT_SCALEANY, MAT_SCALEUNI, and StateBit.

+

+ + + + +
+ + + + + + + + + +
bool NLMISC::CMatrix::hasScaleUniform   const
+
+ + + + + +
+   + + +

+return true if hasScalePart() and if if this scale is uniform. +

+ +

+Definition at line 102 of file matrix.cpp. +

+References MAT_SCALEANY, MAT_SCALEUNI, and StateBit. +

+Referenced by getScaleUniform.

+

+ + + + +
+ + + + + + + + + +
bool NLMISC::CMatrix::hasTrans   const [inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 121 of file matrix.cpp. +

+References MAT_TRANS, and StateBit. +

+Referenced by hasAll, mulPoint, serial, and transpose.

+

+ + + + +
+ + + + + + + + + +
void NLMISC::CMatrix::identity  
+
+ + + + + +
+   + + +

+Reset the matrix to identity. +

+ +

+Definition at line 200 of file matrix.cpp. +

+References a14, a24, a34, MAT_IDENTITY, and StateBit. +

+Referenced by NLLIGO::CZoneEdge::buildMatrix, NL3D::CCubeGrid::CCubeGrid, NL3D::CStaticQuadGrid::clear, NLPACS::CQuadGrid::CQuadGrid, NL3D::CQuadGrid::CQuadGrid, NL3D::CQuadTree::CQuadTree, NL3D::CStaticQuadGrid::CStaticQuadGrid, NL3D::CInstanceGroup::getInstanceMatrix, NL3D::CWaterShape::getShapeInWorldSpace, NL3D::ITravCameraScene::ITravCameraScene, NL3D::CVegetableManager::render, NL3D::CQuadTree::selectRay, NL3D::CQuadTree::selectSegment, serial, setMulMatrix, and setMulMatrixNoProj.

+

+ + + + +
+ + + + + + + + + +
void NLMISC::CMatrix::invert  
+
+ + + + + +
+   + + +

+Invert the matrix. +

+if the matrix can't be inverted, it is set to identity. +

+Definition at line 991 of file matrix.cpp. +

+References inverted. +

+Referenced by NL3D::CCluster::applyMatrix, CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >::compile, and NL3D::CZoneLighter::light.

+

+ + + + +
+ + + + + + + + + +
CMatrix NLMISC::CMatrix::inverted   const
+
+ + + + + +
+   + + +

+Return the matrix inverted. +

+if the matrix can't be inverted, identity is returned. +

+Definition at line 1167 of file matrix.cpp. +

+References a14, a24, a34, CMatrix, fastInvert33, MAT_PROJ, MAT_ROT, MAT_SCALEANY, MAT_TRANS, slowInvert33, slowInvert44, StateBit, testExpandProj, and testExpandRot. +

+Referenced by NL3D::CStaticQuadGrid::build, invert, NL3D::CZoneLighter::lightWater, NL3D::CHeatHaze::performHeatHaze, NL3D::CParticleSystem::setSysMat, NL3D::CParticleSystem::setViewMat, NL3D::CWaterRenderObs::traverse, and NL3D::ITravCameraScene::update.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
const float& NLMISC::CMatrix::mat sint   i,
sint   j
const [inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 357 of file matrix.h. +

+References M.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
float& NLMISC::CMatrix::mat sint   i,
sint   j
[inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 352 of file matrix.h. +

+References M. +

+Referenced by slowInvert44.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::movePos const CVector  v
+
+ + + + + +
+   + + +

+Explicit move the Translation component. +

+

+Parameters:
+ + +
v  +a vector to move the translation vector.
+
+

+Definition at line 279 of file matrix.cpp. +

+References a14, a24, a34, MAT_TRANS, StateBit, and v.

+

+ + + + +
+ + + + + + + + + + +
CVector NLMISC::CMatrix::mulPoint const CVector  v const
+
+ + + + + +
+   + + +

+Multiply a point. ie v.w=1 so the Translation component do affect result. Projection doesn't affect result. +

+ +

+Definition at line 1338 of file matrix.cpp. +

+References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, hasRot, hasTrans, and v. +

+Referenced by operator *.

+

+ + + + +
+ + + + + + + + + + +
CVector NLMISC::CMatrix::mulVector const CVector  v const
+
+ + + + + +
+   + + +

+Multiply a normal. ie v.w=0 so the Translation component doesn't affect result. Projection doesn't affect result. +

+ +

+Definition at line 1321 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, hasRot, and v. +

+Referenced by NL3D::CVegetableManager::addInstance, NL3D::CMeshVPPerPixelLight::begin, NL3D::CParticleSystem::getLODVect, NLPACS::UMoveContainer::getPACSCoordsFromMatrix, and NL3D::ITravCameraScene::update.

+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CMatrix::normalize TRotOrder   pref
+
+ + + + + +
+   + + +

+Normalize the matrix so that the rotation part is now an orthonormal basis, ie a rotation with no scale. +

+NB: projection part and translation part are not modified.

+Parameters:
+ + +
pref  +the preference axis order to normalize. ZYX means that K direction will be kept, and the plane JK will be used to lead the I vector.
+
+Returns:
+false if One of the vector basis is null. true otherwise.
+

+Definition at line 1247 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, getI, getJ, getK, MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, Scale33, StateBit, testExpandRot, XYZ, XZY, YXZ, YZX, ZXY, and ZYX. +

+Referenced by CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >::compile, NL3D::CQuadTree::selectRay, and NL3D::CQuadTree::selectSegment.

+

+ + + + +
+ + + + + + + + + + +
CVectorH NLMISC::CMatrix::operator * const CVectorH  v const
+
+ + + + + +
+   + + +

+Multiply with an homogenous vector. +

+ +

+Definition at line 1367 of file matrix.cpp. +

+References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, testExpandProj, testExpandRot, and v.

+

+ + + + +
+ + + + + + + + + + +
CVector NLMISC::CMatrix::operator * const CVector  v const [inline]
+
+ + + + + +
+   + + +

+Multiply a point.

+See also:
+mulPoint.
+

+ +

+Definition at line 315 of file matrix.h. +

+References mulPoint, and v.

+

+ + + + +
+ + + + + + + + + + +
CMatrix NLMISC::CMatrix::operator * const CMatrix &   in const [inline]
+
+ + + + + +
+   + + +

+Matrix multiplication. +

+ +

+Definition at line 262 of file matrix.h. +

+References CMatrix, and in.

+

+ + + + +
+ + + + + + + + + + +
CMatrix& NLMISC::CMatrix::operator *= const CMatrix &   in [inline]
+
+ + + + + +
+   + + +

+equivalent to M=M*in. +

+ +

+Definition at line 269 of file matrix.h. +

+References CMatrix, and in.

+

+ + + + +
+ + + + + + + + + + +
CMatrix & NLMISC::CMatrix::operator= const CMatrix &  
+
+ + + + + +
+   + + +

+operator=. +

+ +

+Definition at line 168 of file matrix.cpp. +

+References a11, a12, a13, a14, a41, a42, a43, a44, hasAll, hasProj, hasRot, M, MAT_VALIDALL, Scale33, and StateBit.

+

+ + + + +
+ + + + + + + + + +
void NLMISC::CMatrix::resetProj  
+
+ + + + + +
+   + + +

+Reset the Projection component to 0 0 0 1. +

+ +

+Definition at line 309 of file matrix.cpp. +

+References a41, a42, a43, a44, MAT_PROJ, MAT_VALIDPROJ, and StateBit.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::rotate const CQuat  quat
+
+ + + + + +
+   + + +

+Apply a quaternion rotation. +

+ +

+Definition at line 636 of file matrix.cpp. +

+References CMatrix.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CMatrix::rotate const CVector  v,
TRotOrder   ro
+
+ + + + + +
+   + + +

+Apply a euler rotation. +

+

+Parameters:
+ + + +
v  +a vector of 3 angle (in radian), giving rotation around each axis (x,y,z)
ro  +the order of transformation applied. if ro==XYZ, then the transform is M=M*Rx*Ry*Rz
+
+

+Definition at line 618 of file matrix.cpp. +

+References CMatrix, v, XYZ, XZY, YXZ, YZX, ZXY, and ZYX. +

+Referenced by NL3D::CInstanceGroup::getInstanceMatrix, and NL3D::CWaterShape::getShapeInWorldSpace.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::rotateX float   a
+
+ + + + + +
+   + + +

+Apply a rotation on axis X to the matrix. +

+same as M=M*Rx

+Parameters:
+ + +
a  +angle (in radian).
+
+

+Definition at line 498 of file matrix.cpp. +

+References a12, a13, a22, a23, a32, a33, a42, a43, hasProj, hasRot, MAT_ROT, StateBit, and testExpandRot.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::rotateY float   a
+
+ + + + + +
+   + + +

+Apply a rotation on axis Y to the matrix. +

+same as M=M*Ry

+Parameters:
+ + +
a  +angle (in radian).
+
+

+Definition at line 538 of file matrix.cpp. +

+References a11, a13, a21, a23, a31, a33, a41, a43, hasProj, hasRot, MAT_ROT, StateBit, and testExpandRot.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::rotateZ float   a
+
+ + + + + +
+   + + +

+Apply a rotation on axis Z to the matrix. +

+same as M=M*Rz

+Parameters:
+ + +
a  +angle (in radian).
+
+

+Definition at line 578 of file matrix.cpp. +

+References a11, a12, a21, a22, a31, a32, a41, a42, hasProj, MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, StateBit, and testExpandRot. +

+Referenced by NLLIGO::CZoneEdge::buildMatrix.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::scale const CVector  scale
+
+ + + + + +
+   + + +

+Apply a non-uniform scale to the matrix. +

+ +

+Definition at line 669 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, a43, hasProj, MAT_SCALEANY, scale, StateBit, testExpandRot, and v.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::scale float   f
+
+ + + + + +
+   + + +

+Apply a uniform scale to the matrix. +

+ +

+Definition at line 644 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, a43, hasProj, MAT_SCALEANY, MAT_SCALEUNI, Scale33, StateBit, and testExpandRot. +

+Referenced by NL3D::CInstanceGroup::getInstanceMatrix, NL3D::CWaterShape::getShapeInWorldSpace, and scale.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::serial IStream  f
+
+ + + + + +
+   + + +

+ +

+Definition at line 1536 of file matrix.cpp. +

+References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, hasProj, hasRot, hasTrans, identity, Scale33, and StateBit.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::set const float   m44[16]
+
+ + + + + +
+   + + +

+Explicit setup the 4*4 matrix. +

+Avoid it. It implies low compute since no check is done on rotation matrix to see what type of matrix it is (identity, rotation, scale, uniform scale). BUT check are made to see if it has translation or projection components.

+Parameters:
+ + +
m44  +the 4*4 column matrix (4x4 matrix stored in column-major order as 16 consecutive values)
+
+

+Definition at line 320 of file matrix.cpp. +

+References a14, a24, a34, a41, a42, a43, a44, M, MAT_IDENTITY, MAT_PROJ, MAT_ROT, MAT_SCALEANY, MAT_TRANS, MAT_VALIDPROJ, Scale33, and StateBit. +

+Referenced by NL3D::CDriverGL::refreshProjMatrixFromGL.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CMatrix::setMulMatrix const CMatrix &   m1,
const CMatrix &   m2
+
+ + + + + +
+   + + +

+Matrix multiplication. +

+Because of copy avoidance, this is the fastest method Equivalent to *this= m1 * m2

+Warning:
+*this MUST NOT be the same as m1 or m2, else it doesn't work (not checked/nlasserted)
+

+Definition at line 821 of file matrix.cpp. +

+References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, CMatrix, identity, MAT_PROJ, MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, MAT_TRANS, MAT_VALIDALL, MAT_VALIDPROJ, MAT_VALIDROT, nlassert, Scale33, StateBit, and testExpandRot.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CMatrix::setMulMatrixNoProj const CMatrix &   m1,
const CMatrix &   m2
+
+ + + + + +
+   + + +

+Matrix multiplication assuming no projection at all in m1/m2 and Hence this. +

+Even Faster than setMulMatrix() Equivalent to *this= m1 * m2 NB: Also always suppose m1 has a translation, for optim consideration

+Warning:
+*this MUST NOT be the same as m1 or m2, else it doesn't work (not checked/nlasserted)
+

+Definition at line 702 of file matrix.cpp. +

+References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, CMatrix, identity, MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, MAT_TRANS, MAT_VALIDALL, MAT_VALIDROT, nlassert, Scale33, StateBit, and testExpandRot.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::setPos const CVector  v
+
+ + + + + +
+   + + +

+Explicit setup the Translation component. +

+v==Null is tested to see if the matrix now have a translation component.

+Parameters:
+ + +
v  +the translation vector.
+
+

+Definition at line 267 of file matrix.cpp. +

+References a14, a24, a34, MAT_TRANS, StateBit, and v. +

+Referenced by NLLIGO::CZoneEdge::buildMatrix, NL3D::CZoneLighter::lightWater, NL3D::CVegetableManager::render, NL3D::CZoneLighter::testRaytrace, and NL3D::CWaterRenderObs::traverse.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::setProj const float   proj[4]
+
+ + + + + +
+   + + +

+Explicit setup the Projection component. +

+Proj is tested to see if the matrix now have a projection component.

+Parameters:
+ + +
proj  +the 4th line of the matrix. Set it to 0 0 0 1 to reset it to default.
+
+

+Definition at line 291 of file matrix.cpp. +

+References a41, a42, a43, a44, MAT_PROJ, MAT_VALIDPROJ, and StateBit.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::setRot const CMatrix &   matrix
+
+ + + + + +
+   + + +

+Explicit setup the Rotation/Scale matrix (base) with the rotation part of an other matrix. +

+

+Parameters:
+ + +
matrix  +the matrix to copy rot part.
+
+

+Definition at line 243 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, hasRot, MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, MAT_VALIDROT, matrix, Scale33, and StateBit.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::setRot const CQuat  quat
+
+ + + + + +
+   + + +

+Explicit setup the Rotation matrix (base) as a Quaternion rotation matrix. +

+

+Parameters:
+ + +
quat  +a UNIT qauternion
+
+

+Definition at line 1424 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, Scale33, and StateBit.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CMatrix::setRot const CVector  v,
TRotOrder   ro
+
+ + + + + +
+   + + +

+Explicit setup the Rotation matrix (base) as a Euler rotation matrix. +

+

+Parameters:
+ + + +
v  +a vector of 3 angle (in radian), giving rotation around each axis (x,y,z)
ro  +the order of transformation applied. if ro==XYZ, then the transform is M=M*Rx*Ry*Rz
+
+

+Definition at line 231 of file matrix.cpp. +

+References CMatrix, setRot, and v.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CMatrix::setRot const float   m33[9],
bool   hintNoScale = false
+
+ + + + + +
+   + + +

+Explicit setup the Rotation/Scale matrix (base). +

+Avoid it. It implies low compute since no check is done on m33 to see what type of matrix it is (identity, raotation, scale, uniform scale)

+Parameters:
+ + + +
m33  +the 3*3 column rotation matrix. (3x3 matrix stored in column-major order as 9 consecutive values)
hintNoScale  +set it to true if you are sure that your rot matrix is a pure rot matrix with no scale. If set to true and your rotation is not an orthonormal basis, unpredictable result are excepted.
+
+

+Definition at line 220 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, Scale33, and StateBit.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLMISC::CMatrix::setRot const CVector  i,
const CVector  j,
const CVector  k,
bool   hintNoScale = false
+
+ + + + + +
+   + + +

+Explicit setup the Rotation/Scale matrix (base). +

+Avoid it. It implies low compute since no check is done on base to see what type of matrix it is (identity, rotation, scale, uniform scale...)

+Parameters:
+ + + + + +
i  +The I vector of the cartesian base.
j  +The J vector of the cartesian base.
k  +The K vector of the cartesian base.
hintNoScale  +set it to true if you are sure that your rot matrix is a pure rot matrix with no scale. If set to true and your rotation is not an orthonormal basis, unpredictable result are excepted.
+
+

+Definition at line 209 of file matrix.cpp. +

+References a11, a12, a13, a21, a22, a23, a31, a32, a33, MAT_ROT, MAT_SCALEANY, MAT_SCALEUNI, Scale33, and StateBit. +

+Referenced by NL3D::CPSUtil::buildSchmidtBasis, NL3D::CCubeGrid::CCubeGrid, CTrackKeyFramerTCB< CKeyTCBQuat, NLMISC::CAngleAxis >::compile, NL3D::CZoneLighter::lightWater, NL3D::CQuadTree::selectRay, NL3D::CQuadTree::selectSegment, setRot, and NL3D::CSpinnerFunctor::updateSamples.

+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CMatrix::slowInvert33 CMatrix &   ret const [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1076 of file matrix.cpp. +

+References getI, getJ, getK, and s. +

+Referenced by inverted.

+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CMatrix::slowInvert44 CMatrix &   ret const [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1109 of file matrix.cpp. +

+References getCofactIndex, mat, and s. +

+Referenced by inverted.

+

+ + + + +
+ + + + + + + + + +
void NLMISC::CMatrix::testExpandProj   const [inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 149 of file matrix.cpp. +

+References CMatrix, hasProj, MAT_VALIDPROJ, and StateBit. +

+Referenced by get, inverted, operator *, and transpose.

+

+ + + + +
+ + + + + + + + + +
void NLMISC::CMatrix::testExpandRot   const [inline, private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 135 of file matrix.cpp. +

+References CMatrix, hasRot, MAT_VALIDROT, and StateBit. +

+Referenced by get, inverted, normalize, operator *, rotateX, rotateY, rotateZ, scale, setMulMatrix, and setMulMatrixNoProj.

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CMatrix::translate const CVector  v
+
+ + + + + +
+   + + +

+Apply a translation to the matrix. same as M=M*T. +

+

+Parameters:
+ + +
ro  +the RotOrder which show how to get the euler.
+
+Returns:
+one solution of Euler angle. A rotate() with this value and the RotOrder ro will give the same matrix.
+Todo:
+ yoyo: implement it.
+

+Definition at line 470 of file matrix.cpp. +

+References a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43, a44, hasProj, hasRot, MAT_TRANS, StateBit, and v. +

+Referenced by NL3D::CInstanceGroup::getInstanceMatrix, and NL3D::CWaterShape::getShapeInWorldSpace.

+

+ + + + +
+ + + + + + + + + +
void NLMISC::CMatrix::transpose  
+
+ + + + + +
+   + + +

+transpose the matrix (swap columns/lines). +

+NB: this transpose the 4*4 matrix entirely (even proj/translate part). +

+Definition at line 1012 of file matrix.cpp. +

+References a14, a24, a34, a41, a42, a43, hasProj, hasTrans, MAT_PROJ, MAT_TRANS, StateBit, testExpandProj, and transpose3x3.

+

+ + + + +
+ + + + + + + + + +
void NLMISC::CMatrix::transpose3x3  
+
+ + + + + +
+   + + +

+transpose the rotation part only of the matrix (swap columns/lines). +

+ +

+Definition at line 999 of file matrix.cpp. +

+References a12, a13, a21, a23, a31, a32, and hasRot. +

+Referenced by transpose.

+


Friends And Related Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
CPlane operator * const CPlane  p,
const CMatrix &   m
[friend]
+
+ + + + + +
+   + + +

+Plane (line vector) multiplication. +

+ +

+Definition at line 1385 of file matrix.cpp.

+


Member Data Documentation

+

+ + + + +
+ + +
const CMatrix NLMISC::CMatrix::Identity [static] +
+
+ + + + + +
+   + + +

+The identity matrix. Same as CMatrix(). +

+ +

+Definition at line 41 of file matrix.cpp. +

+Referenced by NL3D::CPSLocated::getConversionMatrix, NL3D::CPSLocatedBindable::getInvertedLocatedMat, NL3D::CPSLocatedBindable::getLocatedMat, NL3D::CPSSound::newElement, and NL3D::CSegRemanenceShape::render.

+

+ + + + +
+ + +
float NLMISC::CMatrix::M[16] [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 343 of file matrix.h. +

+Referenced by CMatrix, get, getPos, mat, operator=, and set.

+

+ + + + +
+ + +
float NLMISC::CMatrix::Scale33 [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 344 of file matrix.h. +

+Referenced by fastInvert33, getScaleUniform, normalize, operator=, scale, serial, set, setMulMatrix, setMulMatrixNoProj, and setRot.

+

+ + + + +
+ + +
uint32 NLMISC::CMatrix::StateBit [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 345 of file matrix.h. +

+Referenced by CMatrix, fastInvert33, getRot, hasProj, hasProjectionPart, hasRot, hasScalePart, hasScaleUniform, hasTrans, identity, inverted, movePos, normalize, operator=, resetProj, rotateX, rotateY, rotateZ, scale, serial, set, setMulMatrix, setMulMatrixNoProj, setPos, setProj, setRot, testExpandProj, testExpandRot, translate, and transpose.

+


The documentation for this class was generated from the following files: + + + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1