Skip to content

Commit 7ceba77

Browse files
committed
WIP: move vmatrix functions to header and inline them
1 parent a631383 commit 7ceba77

File tree

6 files changed

+1477
-1688
lines changed

6 files changed

+1477
-1688
lines changed

mathlib/mathlib_base.cpp

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,6 @@ void MatrixGetColumn( const matrix3x4_t& in, int column, Vector &out )
420420
out.z = in[2][column];
421421
}
422422

423-
void MatrixSetColumn( const Vector &in, int column, matrix3x4_t& out )
424-
{
425-
out[0][column] = in.x;
426-
out[1][column] = in.y;
427-
out[2][column] = in.z;
428-
}
429-
430423
void MatrixScaleBy ( const float flScale, matrix3x4_t &out )
431424
{
432425
out[0][0] *= flScale;
@@ -1092,57 +1085,6 @@ void SetScaleMatrix( float x, float y, float z, matrix3x4_t &dst )
10921085
dst[2][0] = 0.0f; dst[2][1] = 0.0f; dst[2][2] = z; dst[2][3] = 0.0f;
10931086
}
10941087

1095-
1096-
//-----------------------------------------------------------------------------
1097-
// Purpose: Builds the matrix for a counterclockwise rotation about an arbitrary axis.
1098-
//
1099-
// | ax2 + (1 - ax2)cosQ axay(1 - cosQ) - azsinQ azax(1 - cosQ) + aysinQ |
1100-
// Ra(Q) = | axay(1 - cosQ) + azsinQ ay2 + (1 - ay2)cosQ ayaz(1 - cosQ) - axsinQ |
1101-
// | azax(1 - cosQ) - aysinQ ayaz(1 - cosQ) + axsinQ az2 + (1 - az2)cosQ |
1102-
//
1103-
// Input : mat -
1104-
// vAxisOrRot -
1105-
// angle -
1106-
//-----------------------------------------------------------------------------
1107-
void MatrixBuildRotationAboutAxis( const Vector &vAxisOfRot, float angleDegrees, matrix3x4_t &dst )
1108-
{
1109-
float radians;
1110-
float axisXSquared;
1111-
float axisYSquared;
1112-
float axisZSquared;
1113-
float fSin;
1114-
float fCos;
1115-
1116-
radians = angleDegrees * ( M_PI / 180.0 );
1117-
fSin = sin( radians );
1118-
fCos = cos( radians );
1119-
1120-
axisXSquared = vAxisOfRot[0] * vAxisOfRot[0];
1121-
axisYSquared = vAxisOfRot[1] * vAxisOfRot[1];
1122-
axisZSquared = vAxisOfRot[2] * vAxisOfRot[2];
1123-
1124-
// Column 0:
1125-
dst[0][0] = axisXSquared + (1 - axisXSquared) * fCos;
1126-
dst[1][0] = vAxisOfRot[0] * vAxisOfRot[1] * (1 - fCos) + vAxisOfRot[2] * fSin;
1127-
dst[2][0] = vAxisOfRot[2] * vAxisOfRot[0] * (1 - fCos) - vAxisOfRot[1] * fSin;
1128-
1129-
// Column 1:
1130-
dst[0][1] = vAxisOfRot[0] * vAxisOfRot[1] * (1 - fCos) - vAxisOfRot[2] * fSin;
1131-
dst[1][1] = axisYSquared + (1 - axisYSquared) * fCos;
1132-
dst[2][1] = vAxisOfRot[1] * vAxisOfRot[2] * (1 - fCos) + vAxisOfRot[0] * fSin;
1133-
1134-
// Column 2:
1135-
dst[0][2] = vAxisOfRot[2] * vAxisOfRot[0] * (1 - fCos) + vAxisOfRot[1] * fSin;
1136-
dst[1][2] = vAxisOfRot[1] * vAxisOfRot[2] * (1 - fCos) - vAxisOfRot[0] * fSin;
1137-
dst[2][2] = axisZSquared + (1 - axisZSquared) * fCos;
1138-
1139-
// Column 3:
1140-
dst[0][3] = 0;
1141-
dst[1][3] = 0;
1142-
dst[2][3] = 0;
1143-
}
1144-
1145-
11461088
//-----------------------------------------------------------------------------
11471089
// Computes the transpose
11481090
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)