1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-12-30 17:09:03 +00:00

improved headers / conditional compilation

This commit is contained in:
Zeno Rogue
2017-12-02 00:31:36 +01:00
parent 9c789c6591
commit 5defb06d81
9 changed files with 258 additions and 223 deletions

View File

@@ -150,15 +150,6 @@ const transmatrix MirrorX = {{{-1,0,0}, {0,1,0}, {0,0,1}}};
// rotate by PI
const transmatrix pispin = {{{-1,0,0}, {0,-1,0}, {0,0,1}}};
hyperpoint operator * (const transmatrix& T, const hyperpoint& H) {
hyperpoint z;
for(int i=0; i<3; i++) {
z[i] = 0;
for(int j=0; j<3; j++) z[i] += T[i][j] * H[j];
}
return z;
}
// T * C0, optimized
inline hyperpoint tC0(const transmatrix &T) {
hyperpoint z;
@@ -166,14 +157,6 @@ inline hyperpoint tC0(const transmatrix &T) {
return z;
}
inline transmatrix operator * (const transmatrix& T, const transmatrix& U) {
transmatrix R;
// for(int i=0; i<3; i++) for(int j=0; j<3; j++) R[i][j] = 0;
for(int i=0; i<3; i++) for(int j=0; j<3; j++) // for(int k=0; k<3; k++)
R[i][j] = T[i][0] * U[0][j] + T[i][1] * U[1][j] + T[i][2] * U[2][j];
return R;
}
// rotate by alpha degrees
transmatrix spin(ld alpha) {
transmatrix T = Id;
@@ -305,8 +288,6 @@ transmatrix rgpushxto0(const hyperpoint& H) {
// fix the matrix T so that it is indeed an isometry
// (without using this, imprecision could accumulate)
void display(const transmatrix& T);
void fixmatrix(transmatrix& T) {
if(euclid) {
for(int x=0; x<2; x++) for(int y=0; y<=x; y++) {