Difference between revisions of "HPL3/SOMA/Scripting/cMatrixf"
Jump to navigation
Jump to search
(Created page with "A 4x4 matrix which stores its elements as floats. ==Constructors== {| class="wikitable" ! Constructor !! Description |- | <syntaxhighlight lang="c++" inline>cMatrixf()</syn...") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | A 4x4 matrix which stores its elements as floats. | + | A 4x4 matrix which stores its elements as floats. It is frequently used in transformation-related functions. (i.e. translation, rotation, scale, etc.) |
==Constructors== | ==Constructors== | ||
Line 48: | Line 48: | ||
| <syntaxhighlight lang="c++" inline>void</syntaxhighlight> || SetUp || [[../cVector3f|<syntaxhighlight lang="c++" inline>const cVector3f &in avVec</syntaxhighlight>]] || | | <syntaxhighlight lang="c++" inline>void</syntaxhighlight> || SetUp || [[../cVector3f|<syntaxhighlight lang="c++" inline>const cVector3f &in avVec</syntaxhighlight>]] || | ||
|} | |} | ||
+ | |||
+ | ==Remarks== | ||
+ | |||
+ | To retrieve a value from a matrix, use the <code>GetElement</code> function above. The parameters for the <code>GetElement</code> function use the format GetElement(columnIndex, rowIndex). | ||
+ | |||
+ | <syntaxhighlight lang="c++">cMatrixf m1(cVector4f(0, 1, 2, 3), | ||
+ | cVector4f(4, 5, 6, 7), | ||
+ | cVector4f(8, 9, 10, 11), | ||
+ | cVector4f(12, 13, 14, 15)); | ||
+ | |||
+ | float f = m1.GetElement(1, 2); | ||
+ | |||
+ | // value of f: 9</syntaxhighlight> | ||
+ | |||
+ | To do matrix computations, use the [[cmath_matrixslerp|cMath_MatrixXXX]] family of functions. | ||
+ | |||
+ | <syntaxhighlight lang="c++">cMatrixf m1(cVector4f(1, 1, 1, 1), | ||
+ | cVector4f(2, 2, 2, 2), | ||
+ | cVector4f(3, 3, 3, 3), | ||
+ | cVector4f(4, 4, 4, 4)); | ||
+ | |||
+ | cMatrixf m2(cVector4f(5, 5, 5, 5), | ||
+ | cVector4f(6, 6, 6, 6), | ||
+ | cVector4f(7, 7, 7, 7), | ||
+ | cVector4f(8, 8, 8, 8)); | ||
+ | |||
+ | cMatrixf m3 = cMath_MatrixMul(m1, m2); | ||
+ | |||
+ | // value of m3: { 26, 26, 26, 26, | ||
+ | // 52, 52, 52, 52, | ||
+ | // 78, 78, 78, 78, | ||
+ | // 104, 104, 104, 104 }</syntaxhighlight> | ||
+ | |||
+ | {{ReferencesSection}} | ||
{{HPL3SOMAScriptingCategories}} | {{HPL3SOMAScriptingCategories}} | ||
__FORCETOC__ | __FORCETOC__ |
Latest revision as of 15:10, 6 August 2020
A 4x4 matrix which stores its elements as floats. It is frequently used in transformation-related functions. (i.e. translation, rotation, scale, etc.)
Constructors
Constructor | Description |
---|---|
cMatrixf() |
Creates a matrix with default values. |
cMatrixf(cVector4f, cVector4f, cVector4f, cVector4f) |
Creates a matrix using the given vectors as column data. |
cMatrixf(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) |
Creates a matrix using the given values as cell data. |
Fields
cMatrixf has no public fields.
Functions
Return Type | Function Name | Parameters | Description |
---|---|---|---|
float |
GetElement | uint64 ,uint64 |
|
cVector3f |
GetForward | ||
cVector3f |
GetRight | ||
cMatrixf |
GetRotation | ||
cVector3f |
GetTranslation | ||
cMatrixf |
GetTranspose | ||
cVector3f |
GetUp | ||
void |
SetForward | const cVector3f &in avVec |
|
void |
SetRight | const cVector3f &in avVec |
|
void |
SetRotation | float afXX ,float afXY ,float afXZ ,float afYX ,float afYY ,float afYZ ,float afZX ,float afZY ,float afZZ |
|
void |
SetRotation | const cMatrixf &in a_mtxRot |
|
void |
SetTranslation | const cVector3f &in avTrans |
|
void |
SetUp | const cVector3f &in avVec |
Remarks
To retrieve a value from a matrix, use the GetElement
function above. The parameters for the GetElement
function use the format GetElement(columnIndex, rowIndex).
cMatrixf m1(cVector4f(0, 1, 2, 3),
cVector4f(4, 5, 6, 7),
cVector4f(8, 9, 10, 11),
cVector4f(12, 13, 14, 15));
float f = m1.GetElement(1, 2);
// value of f: 9
To do matrix computations, use the cMath_MatrixXXX family of functions.
cMatrixf m1(cVector4f(1, 1, 1, 1),
cVector4f(2, 2, 2, 2),
cVector4f(3, 3, 3, 3),
cVector4f(4, 4, 4, 4));
cMatrixf m2(cVector4f(5, 5, 5, 5),
cVector4f(6, 6, 6, 6),
cVector4f(7, 7, 7, 7),
cVector4f(8, 8, 8, 8));
cMatrixf m3 = cMath_MatrixMul(m1, m2);
// value of m3: { 26, 26, 26, 26,
// 52, 52, 52, 52,
// 78, 78, 78, 78,
// 104, 104, 104, 104 }
References
- HPL3/SOMA/Scripting/cBeam (← links)
- HPL3/SOMA/Scripting/cBeamEnd (← links)
- HPL3/SOMA/Scripting/cBillboard (← links)
- HPL3/SOMA/Scripting/cBoneState (← links)
- HPL3/SOMA/Scripting/cBoundingVolume (← links)
- HPL3/SOMA/Scripting/cCamera (← links)
- HPL3/SOMA/Scripting/cClothEntity (← links)
- HPL3/SOMA/Scripting/cEntityBodyExtraData (← links)
- HPL3/SOMA/Scripting/cExposureArea (← links)
- HPL3/SOMA/Scripting/cFogArea (← links)
- HPL3/SOMA/Scripting/cForceField (← links)
- HPL3/SOMA/Scripting/cFrustum (← links)
- HPL3/SOMA/Scripting/cGuiSet (← links)
- HPL3/SOMA/Scripting/cGuiSetEntity (← links)
- HPL3/SOMA/Scripting/cLensFlare (← links)
- HPL3/SOMA/Scripting/cLightBox (← links)
- HPL3/SOMA/Scripting/cLightDirectional (← links)
- HPL3/SOMA/Scripting/cLightPoint (← links)
- HPL3/SOMA/Scripting/cLightSpot (← links)
- HPL3/SOMA/Scripting/cLuxAgent (← links)
- HPL3/SOMA/Scripting/cLuxArea (← links)
- HPL3/SOMA/Scripting/cLuxCritter (← links)
- HPL3/SOMA/Scripting/cLuxGuiHandler (← links)
- HPL3/SOMA/Scripting/cLuxLiquidArea (← links)
- HPL3/SOMA/Scripting/cLuxMap (← links)
- HPL3/SOMA/Scripting/cLuxProp (← links)
- HPL3/SOMA/Scripting/cLuxSoundscapeArea (← links)
- HPL3/SOMA/Scripting/cLuxVisibilityArea (← links)
- HPL3/SOMA/Scripting/cLuxVisibilityPortal (← links)
- HPL3/SOMA/Scripting/cMeshEntity (← links)
- HPL3/SOMA/Scripting/cNode3D (← links)
- HPL3/SOMA/Scripting/cParticleSystem (← links)
- HPL3/SOMA/Scripting/cQuaternion (← links)
- HPL3/SOMA/Scripting/cRendererCallbackFunctions (← links)
- HPL3/SOMA/Scripting/cRopeEntity3D (← links)
- HPL3/SOMA/Scripting/cRopeEntityBillboard (← links)
- HPL3/SOMA/Scripting/cSoundEntity (← links)
- HPL3/SOMA/Scripting/cSubMesh (← links)
- HPL3/SOMA/Scripting/cSubMeshEntity (← links)
- HPL3/SOMA/Scripting/iCharacterBody (← links)
- HPL3/SOMA/Scripting/iCollideShape (← links)
- HPL3/SOMA/Scripting/iEntity3D (← links)
- HPL3/SOMA/Scripting/iLight (← links)
- HPL3/SOMA/Scripting/iLuxEntity (← links)
- HPL3/SOMA/Scripting/iPhysicsBody (← links)
- HPL3/SOMA/Scripting/iPhysicsWorld (← links)
- HPL3/SOMA/Scripting/iRenderableEntity (← links)
- HPL3/SOMA/Scripting/iRopeEntity (← links)
- HPL3/SOMA/Scripting/Scripting Api (← links)
- HPL3/SOMA/Scripting/Scripting Api/cLux (← links)