Fix Matrix3x3::Matrix3x3(Quaternion)

This commit is contained in:
2024-05-22 20:12:53 -04:00
parent 85f717ba27
commit e18a2cdfbf
3 changed files with 41 additions and 23 deletions

View File

@@ -816,4 +816,33 @@ namespace J3ML::LinearAlgebra {
p[3][0] = 0; p[3][1] = 0; p[3][2] = 1.f; p[3][3] = 0.f;
}
Matrix4x4 Matrix4x4::D3DPerspProjRH(float n, float f, float h, float v) {
Matrix4x4 p;
p[0][0] = 2.f * n / h; p[0][1] = 0; p[0][2] = 0; p[0][3] = 0.f;
p[1][0] = 0; p[1][1] = 2.f * n / v; p[1][2] = 0; p[1][3] = 0.f;
p[2][0] = 0; p[2][1] = 0; p[2][2] = f / (f-n); p[2][3] = n * f / (n-f);
p[3][0] = 0; p[3][1] = 0; p[3][2] = 1.f; p[3][3] = 0.f;
return p;
}
bool Matrix4x4::Inverse(float epsilon) {
return InverseMatrix(*this, epsilon);
}
bool Matrix4x4::LUDecompose(Matrix4x4 &outLower, Matrix4x4 &outUpper) const {
return LUDecomposeMatrix(*this, outLower, outUpper);
}
bool Matrix4x4::CholeskyDecompose(Matrix4x4 &outL) const {
return CholeskyDecomposeMatrix(*this, outL);
}
Matrix4x4 Matrix4x4::InverseTransposed() const {
Matrix4x4 copy = *this;
copy.Transpose();
copy.Inverse();
return copy;
}
}