1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

reg3:: cellrotations

This commit is contained in:
Zeno Rogue 2019-10-12 11:22:13 +02:00
parent 0a465a7af5
commit 352f9ed8a9
2 changed files with 29 additions and 0 deletions

View File

@ -289,6 +289,8 @@ hpcshape
vector<array<int, 3>> symmetriesAt;
vector<pair<transmatrix, vector<int> > > cellrotations;
#ifndef SCALETUNER
static constexpr
#endif

View File

@ -900,6 +900,33 @@ EX bool pseudohept(cell *c) {
}
#endif
EX void generate_cellrotations() {
auto &cr = cgi.cellrotations;
if(isize(cr)) return;
for(int a=0; a<S7; a++)
for(int b=0; b<S7; b++)
for(int c=0; c<S7; c++) {
using reg3::adjmoves;
transmatrix T = build_matrix(adjmoves[a]*C0, adjmoves[b]*C0, adjmoves[c]*C0, C0);
if(abs(det(T)) < 0.001) continue;
transmatrix U = build_matrix(adjmoves[0]*C0, adjmoves[1]*C0, adjmoves[2]*C0, C0);
transmatrix S = U * inverse(T);
if(abs(det(S) - 1) > 0.01) continue;
vector<int> perm(S7);
for(int x=0; x<S7; x++) perm[x] = -1;
for(int x=0; x<S7; x++)
for(int y=0; y<S7; y++)
if(hdist(S * adjmoves[x] * C0, adjmoves[y] * C0) < .1) perm[x] = y;
bool bad = false;
for(int x=0; x<S7; x++) if(perm[x] == -1) bad = true;
if(bad) continue;
cr.emplace_back(S, perm);
}
}
#if 0
/* More precise, but very slow distance. Not used/optimized for now */