1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

nilv:: works with small periods

This commit is contained in:
Zeno Rogue 2019-11-08 15:42:31 +01:00
parent f7fc9d7d5d
commit 6dd47c903d
4 changed files with 15 additions and 8 deletions

View File

@ -259,8 +259,11 @@ void virtualRebase_cell(cell*& base, T& at, const U& check) {
T best_at = at; T best_at = at;
while(true) { while(true) {
cell *newbase = NULL; cell *newbase = NULL;
forCellCM(c2, base) { forCellIdCM(c2, i, base) {
transmatrix V2 = calc_relative_matrix(base, c2, C0); transmatrix V2 =
nil ? nilv::adjmatrix(base->c.spin(i)) :
asonov::in() ? asonov::adjmatrix(base->c.spin(i)) :
calc_relative_matrix(base, c2, C0);
T cand_at = V2 * at; T cand_at = V2 * at;
horo_distance newz(check(cand_at)); horo_distance newz(check(cand_at));
if(newz < currz) { if(newz < currz) {

View File

@ -1490,7 +1490,10 @@ EX void optimizeview() {
if(penrose && euclid && (i < 4 || i >= 8)) continue; if(penrose && euclid && (i < 4 || i >= 8)) continue;
int i1 = i * DUALMUL; int i1 = i * DUALMUL;
heptagon *h2 = createStep(viewctr.at, i1); heptagon *h2 = createStep(viewctr.at, i1);
transmatrix T = asonov::in() ? asonov::adjmatrix(i) : currentmap->relative_matrix(h2, viewctr.at); transmatrix T =
asonov::in() ? asonov::adjmatrix(i) :
nil ? nilv::adjmatrix(i) :
currentmap->relative_matrix(h2, viewctr.at);
#if MAXMDIM >= 4 #if MAXMDIM >= 4
if(euclid && WDIM == 3) if(euclid && WDIM == 3)
T = euclid3::move_matrix(viewctr.at->c7, i); T = euclid3::move_matrix(viewctr.at->c7, i);

View File

@ -783,6 +783,10 @@ EX namespace nilv {
EX array<int,3> nilperiod, nilperiod_edit; EX array<int,3> nilperiod, nilperiod_edit;
EX transmatrix adjmatrix(int i) {
return nisot::translate(mvec_to_point(movevectors[i]));
}
struct hrmap_nil : hrmap { struct hrmap_nil : hrmap {
unordered_map<mvec, heptagon*> at; unordered_map<mvec, heptagon*> at;
unordered_map<heptagon*, mvec> coords; unordered_map<heptagon*, mvec> coords;
@ -817,10 +821,6 @@ EX namespace nilv {
return child; return child;
} }
transmatrix adjmatrix(int i) {
return nisot::translate(mvec_to_point(movevectors[i]));
}
virtual transmatrix relative_matrix(heptagon *h2, heptagon *h1) override { virtual transmatrix relative_matrix(heptagon *h2, heptagon *h1) override {
for(int a=0; a<S7; a++) if(h2 == h1->move(a)) return adjmatrix(a); for(int a=0; a<S7; a++) if(h2 == h1->move(a)) return adjmatrix(a);
return nisot::translate(mvec_to_point(coords[h1].inverse() * coords[h2])); return nisot::translate(mvec_to_point(coords[h1].inverse() * coords[h2]));

View File

@ -840,6 +840,7 @@ EX void cast() {
vector<transmatrix> ms; vector<transmatrix> ms;
for(int j=0; j<S7; j++) ms.push_back( for(int j=0; j<S7; j++) ms.push_back(
asonov::in() ? asonov::adjmatrix((j+S7/2)%S7) : asonov::in() ? asonov::adjmatrix((j+S7/2)%S7) :
nil ? nilv::adjmatrix((j+S7/2)%S7) :
prod ? currentmap->relative_matrix(cwt.at, cwt.at->cmove(j), Hypc) : currentmap->relative_matrix(cwt.at->master, cwt.at->cmove(j)->master)); prod ? currentmap->relative_matrix(cwt.at, cwt.at->cmove(j), Hypc) : currentmap->relative_matrix(cwt.at->master, cwt.at->cmove(j)->master));
if(prod) ms.push_back(Id); if(prod) ms.push_back(Id);
if(prod) ms.push_back(Id); if(prod) ms.push_back(Id);
@ -904,7 +905,7 @@ EX void cast() {
connections[u][2] = (S7+.5) / 1024.; connections[u][2] = (S7+.5) / 1024.;
continue; continue;
} }
transmatrix T = asonov::in() ? Id : (prod ? currentmap->relative_matrix(c, c1, C0) : currentmap->relative_matrix(c->master, c1->master)) * inverse(ms[i]); transmatrix T = (asonov::in() || nil) ? Id : (prod ? currentmap->relative_matrix(c, c1, C0) : currentmap->relative_matrix(c->master, c1->master)) * inverse(ms[i]);
for(int k=0; k<=isize(ms); k++) { for(int k=0; k<=isize(ms); k++) {
if(k < isize(ms) && !eqmatrix(ms[k], T)) continue; if(k < isize(ms) && !eqmatrix(ms[k], T)) continue;
if(k == isize(ms)) ms.push_back(T); if(k == isize(ms)) ms.push_back(T);