mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
euclid:: fixed relative_matrix
This commit is contained in:
parent
91875f2b74
commit
30329df05c
34
euclid.cpp
34
euclid.cpp
@ -191,34 +191,30 @@ EX namespace euclid3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transmatrix warppush(coord dif) {
|
|
||||||
auto v = getcoord(dif);
|
|
||||||
for(int i: {0, 1})
|
|
||||||
if(T0[i][i])
|
|
||||||
v[i] = gmod(v[i] + T0[i][i] / 2, T0[i][i]) - T0[i][i] / 2;
|
|
||||||
return eupush3(v[0], v[1], v[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
|
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
|
||||||
if(twisted) {
|
if(twisted) {
|
||||||
if(h1 == h2) return Id;
|
if(h1 == h2) return Id;
|
||||||
for(int s=0; s<S7; s++) if(h2 == h1->move(s)) return adj(h1, s);
|
for(int s=0; s<S7; s++) if(h2 == h1->move(s)) return adj(h1, s);
|
||||||
coord c1 = ispacemap[h1];
|
coord c1 = ispacemap[h1];
|
||||||
coord c2 = ispacemap[h2];
|
coord c2 = ispacemap[h2];
|
||||||
transmatrix T = warppush(c2 - c1);
|
transmatrix T = eumove(c2 - c1);
|
||||||
for(int d: {-1, 1}) {
|
|
||||||
transmatrix I = Id;
|
transmatrix I = Id;
|
||||||
coord cs = c1;
|
coord cs = c1;
|
||||||
for(int s=0; s<3; s++) {
|
for(int s=0; s<4; s++) {
|
||||||
cs += d * T0[2][2] * main_axes[2];
|
for(int a=-1; a<=1; a++)
|
||||||
I = I * eupush3(0, 0, d * T0[2][2]);
|
for(int b=-1; b<=1; b++) {
|
||||||
auto dummy = getcoord(0);
|
if(b && WDIM == 2) continue;
|
||||||
bool dm = false;
|
transmatrix T1 = I * eumove((c2 - cs) + a*ascoord(T0[0]) + b*ascoord(T0[1]));
|
||||||
cs = twist(cs, dummy, I, dm);
|
|
||||||
transmatrix T1 = I * warppush(c2 - cs);
|
|
||||||
if(hdist0(tC0(T1)) < hdist0(tC0(T)))
|
if(hdist0(tC0(T1)) < hdist0(tC0(T)))
|
||||||
T = T1;
|
T = T1;
|
||||||
}
|
}
|
||||||
|
auto co = ascoord(T0[WDIM-1]);
|
||||||
|
cs += co;
|
||||||
|
I = I * eumove(co);
|
||||||
|
auto dummy = getcoord(0);
|
||||||
|
bool dm = false;
|
||||||
|
cs = twist(cs, dummy, I, dm);
|
||||||
}
|
}
|
||||||
return T;
|
return T;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user