mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
in sl2, sl2 handling of shifts is executed even if model uses bandshift
This commit is contained in:
parent
84a6d2f8f9
commit
de859c35aa
48
hypgraph.cpp
48
hypgraph.cpp
@ -2726,27 +2726,21 @@ EX void draw_boundary(int w) {
|
|||||||
EX void change_shift(shiftpoint& h, ld by) {
|
EX void change_shift(shiftpoint& h, ld by) {
|
||||||
if(!by) return;
|
if(!by) return;
|
||||||
h.shift += by;
|
h.shift += by;
|
||||||
if((mdinf[pmodel].flags & mf::uses_bandshift) || (sphere && pmodel == mdSpiral)) {
|
|
||||||
h.h = spin(pconf.model_orientation * degree) * h.h;
|
|
||||||
h.h = xpush(-by) * h.h;
|
|
||||||
h.h = spin(-pconf.model_orientation * degree) * h.h;
|
|
||||||
}
|
|
||||||
if(sl2) {
|
if(sl2) {
|
||||||
ld ca = cos(by), sa = sin(by);
|
ld ca = cos(by), sa = sin(by);
|
||||||
tie(h[2], h[3]) = make_pair(h[2] * ca - h[3] * sa, h[3] * ca + h[2] * sa);
|
tie(h[2], h[3]) = make_pair(h[2] * ca - h[3] * sa, h[3] * ca + h[2] * sa);
|
||||||
tie(h[0], h[1]) = make_pair(h[0] * ca - h[1] * sa, h[1] * ca + h[0] * sa);
|
tie(h[0], h[1]) = make_pair(h[0] * ca - h[1] * sa, h[1] * ca + h[0] * sa);
|
||||||
}
|
}
|
||||||
|
else if((mdinf[pmodel].flags & mf::uses_bandshift) || (sphere && pmodel == mdSpiral)) {
|
||||||
|
h.h = spin(pconf.model_orientation * degree) * h.h;
|
||||||
|
h.h = xpush(-by) * h.h;
|
||||||
|
h.h = spin(-pconf.model_orientation * degree) * h.h;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void change_shift(shiftmatrix& T, ld by) {
|
EX void change_shift(shiftmatrix& T, ld by) {
|
||||||
if(!by) return;
|
if(!by) return;
|
||||||
T.shift += by;
|
T.shift += by;
|
||||||
if((mdinf[pmodel].flags & mf::uses_bandshift) || (sphere && pmodel == mdSpiral)) {
|
|
||||||
T.T = spin(pconf.model_orientation * degree) * T.T;
|
|
||||||
T.T = xpush(-by) * T.T;
|
|
||||||
fixmatrix(T.T);
|
|
||||||
T.T = spin(-pconf.model_orientation * degree) * T.T;
|
|
||||||
}
|
|
||||||
if(sl2) {
|
if(sl2) {
|
||||||
ld ca = cos(by), sa = sin(by);
|
ld ca = cos(by), sa = sin(by);
|
||||||
for(int a=0; a<4; a++) {
|
for(int a=0; a<4; a++) {
|
||||||
@ -2754,6 +2748,12 @@ EX void change_shift(shiftmatrix& T, ld by) {
|
|||||||
tie(T[0][a], T[1][a]) = make_pair(T[0][a] * ca - T[1][a] * sa, T[1][a] * ca + T[0][a] * sa);
|
tie(T[0][a], T[1][a]) = make_pair(T[0][a] * ca - T[1][a] * sa, T[1][a] * ca + T[0][a] * sa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if((mdinf[pmodel].flags & mf::uses_bandshift) || (sphere && pmodel == mdSpiral)) {
|
||||||
|
T.T = spin(pconf.model_orientation * degree) * T.T;
|
||||||
|
T.T = xpush(-by) * T.T;
|
||||||
|
fixmatrix(T.T);
|
||||||
|
T.T = spin(-pconf.model_orientation * degree) * T.T;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EX transmatrix unshift(shiftmatrix T, ld to IS(0)) {
|
EX transmatrix unshift(shiftmatrix T, ld to IS(0)) {
|
||||||
@ -2781,7 +2781,20 @@ EX void optimize_shift(shiftpoint& h) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX void optimize_shift(shiftmatrix& T) {
|
EX void optimize_shift(shiftmatrix& T) {
|
||||||
if(((mdinf[pmodel].flags & mf::uses_bandshift) && T[LDIM][LDIM] > 30) || (sphere && pmodel == mdSpiral)) {
|
|
||||||
|
if(sl2) {
|
||||||
|
change_shift(T, atan2(T[2][3], T[3][3]));
|
||||||
|
if(hybrid::csteps) {
|
||||||
|
auto period = (M_PI * hybrid::csteps) / cgi.psl_steps;
|
||||||
|
while(T.shift > period*.4999)
|
||||||
|
T.shift -= period;
|
||||||
|
while(T.shift < -period*.5001)
|
||||||
|
T.shift += period;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(((mdinf[pmodel].flags & mf::uses_bandshift) && T[LDIM][LDIM] > 30) || (sphere && pmodel == mdSpiral)) {
|
||||||
T.T = spin(pconf.model_orientation * degree) * T.T;
|
T.T = spin(pconf.model_orientation * degree) * T.T;
|
||||||
hyperpoint H = tC0(T.T);
|
hyperpoint H = tC0(T.T);
|
||||||
find_zlev(H);
|
find_zlev(H);
|
||||||
@ -2797,17 +2810,6 @@ EX void optimize_shift(shiftmatrix& T) {
|
|||||||
fixmatrix(T.T);
|
fixmatrix(T.T);
|
||||||
T.T = spin(-pconf.model_orientation * degree) * T.T;
|
T.T = spin(-pconf.model_orientation * degree) * T.T;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sl2) {
|
|
||||||
change_shift(T, atan2(T[2][3], T[3][3]));
|
|
||||||
if(hybrid::csteps) {
|
|
||||||
auto period = (M_PI * hybrid::csteps) / cgi.psl_steps;
|
|
||||||
while(T.shift > period*.4999)
|
|
||||||
T.shift -= period;
|
|
||||||
while(T.shift < -period*.5001)
|
|
||||||
T.shift += period;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EX shiftmatrix optimized_shift(const shiftmatrix& T) {
|
EX shiftmatrix optimized_shift(const shiftmatrix& T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user