Matrix Module of libSIMDx86
The Matrix module of libSIMDx86 gives functions to accelerate 4x4 matrix operations commonly used in 3D graphics and solving systems of equations.

#include <SIMDx86/matrix.h>


typedef struct SIMDx86Matrix

{

float m[16];

} SIMDx86Matrix;


void SIMDx86Matrix_Sum(SIMDx86Matrix* pMat, const SIMDx86Matrix* pIn);

Sums pMat and pIn and stores the result in pMat.


void SIMDx86Matrix_SumOf(SIMDx86Matrix* pMat, const SIMDx86Matrix* pIn1, const SIMDx86Matrix* pIn2);

Sums pIn1 and pIn2 and stores the result in pMat.


void SIMDx86Matrix_Diff(SIMDx86Matrix* pMat, const SIMDx86Matrix* pIn);

Subtracts pIn from pMat and stores the result in pMat.


void SIMDx86Matrix_DiffOf(SIMDx86Matrix* pMat, const SIMDx86Matrix* pLeft, const SIMDx86Matrix* pRight);

Subtracts pRight from pLeft and stores the result in pMat.


void SIMDx86Matrix_Scale(SIMDx86Matrix* pMat, float scalar);

Scales the components of pMat by scalar and stores the result in pMat.


void SIMDx86Matrix_ScaleOf(SIMDx86Matrix* pMat, const SIMDx86Matrix* pIn, float scalar);

Scales the components of pIn by scalar and stores the result in pMat.


void SIMDx86Matrix_Multiply(SIMDx86Matrix* pLeft, const SIMDx86Matrix* pRight);

Multiplies pLeft by pRight and stores the result in pLeft.


void SIMDx86Matrix_MultiplyOf(SIMDx86Matrix* pMat, const SIMDx86Matrix* pLeft, const SIMDx86Matrix* pRight);
Multiplies pLeft by pRight and stores the result in pLeft.


void SIMDx86Matrix_Transpose(SIMDx86Matrix* pIn);

Transposes the matrix pIn stores the result in pIn.


void SIMDx86Matrix_TransposeOf(SIMDx86Matrix* pOut, const SIMDx86Matrix* pIn);

Transposes the matrix pIn stores the result in pOut.


void SIMDx86Matrix_VectorMultiply(SIMDx86Vector* pVec, const SIMDx86Matrix* pMat);

Transforms the 3D vector (as 4D with w = 1.0) pVec by the matrix pMat and stores the result in pVec. The w component is discarded. If you need to save the w component (for example, a software renderer uses it for perspective correction) then use 4D vectors with SIMDx86Matrix_Vector4Multiply().


void SIMDx86Matrix_VectorMultiplyOf(SIMDx86Vector* pOut, const SIMDx86Vector* pIn, const SIMDx86Matrix* pMat);

Transforms the 3D vector (as 4D with w = 1.0) pIn by the matrix pMat and stores the result in pOut. The w component is discarded. If you need to save the w component (for example, a software renderer uses it for perspective correction) then use 4D vectors with SIMDx86Matrix_Vector4MultiplyOf().


void SIMDx86Matrix_Vector4Multiply(float* pVec4D, const SIMDx86Matrix* pMat);

Transforms the 4D vector pVec4D by the matrix pMat and stores the result in pVec4D.


void SIMDx86Matrix_Vector4MultiplyOf(float* pOut4D, const float* pIn4D, const SIMDx86Matrix* pMat);

Transforms the 4D vector pIn4D by the matrix pMat and stores the result in pOut4D.



BACK