invert assert
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#include "misc/Maths.h"
|
#include "misc/Maths.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace maths {
|
namespace maths {
|
||||||
|
|
||||||
@@ -56,6 +58,8 @@ Mat4f Inverse(const Mat4f& mat) {
|
|||||||
// Should check for 0 determinant
|
// Should check for 0 determinant
|
||||||
float invdet = 1.0 / (s0 * c5 - s1 * c4 + s2 * c3 + s3 * c2 - s4 * c1 + s5 * c0);
|
float invdet = 1.0 / (s0 * c5 - s1 * c4 + s2 * c3 + s3 * c2 - s4 * c1 + s5 * c0);
|
||||||
|
|
||||||
|
assert(invdet != 0 && "Determinant equals 0 !");
|
||||||
|
|
||||||
Mat4f result;
|
Mat4f result;
|
||||||
|
|
||||||
result.at(0, 0) = ( mat.at(1, 1) * c5 - mat.at(1, 2) * c4 + mat.at(1, 3) * c3) * invdet;
|
result.at(0, 0) = ( mat.at(1, 1) * c5 - mat.at(1, 2) * c4 + mat.at(1, 3) * c3) * invdet;
|
||||||
|
|||||||
Reference in New Issue
Block a user