hyperpoint:: ortho_error

This commit is contained in:
Zeno Rogue 2019-08-03 12:59:08 +02:00
parent d0589fc1e4
commit 7eae04e2ea
1 changed files with 15 additions and 0 deletions

View File

@ -809,4 +809,19 @@ transmatrix spin_towards(const transmatrix Position, const hyperpoint goal, int
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;
}
}