1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-01-20 06:03:01 +00:00

hyperpoint:: ortho_error

This commit is contained in:
Zeno Rogue 2019-08-03 12:59:08 +02:00
parent d0589fc1e4
commit 7eae04e2ea

View File

@ -809,4 +809,19 @@ transmatrix spin_towards(const transmatrix Position, const hyperpoint goal, int
return T; return T;
} }
ld ortho_error(transmatrix T) {
ld err = 0;
for(int x=0; x<3; x++) for(int y=0; y<3; y++) {
ld s = 0;
for(int z=0; z<3; z++) s += T[z][x] * T[z][y];
s -= (x==y);
err += s*s;
}
return err;
}
} }