1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

inverse_error as a separate function (helps with debugging)

This commit is contained in:
Zeno Rogue 2018-08-19 22:54:11 +02:00
parent 676ea3a1f9
commit 1c8f0e7e37

View File

@ -471,18 +471,20 @@ ld det(const transmatrix& T) {
det -= T[0][i] * T[1][(i+2)%3] * T[2][(i+1)%3];
return det;
}
void inverse_error(const transmatrix& T) {
printf("Warning: inverting a singular matrix\n");
display(T);
}
transmatrix inverse(const transmatrix& T) {
profile_start(7);
ld d = det(T);
transmatrix T2;
if(d == 0) {
printf("Warning: inverting a singular matrix\n");
display(T);
display(T2);
T2 = Id;
return T2;
if(d == 0) {
inverse_error(T);
return Id;
}
for(int i=0; i<3; i++)