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

made -twisted-product work with pure hex

This commit is contained in:
Zeno Rogue 2024-06-16 19:17:33 +02:00
parent 3d9c4c838e
commit 6b04db89d2
3 changed files with 17 additions and 3 deletions

View File

@ -825,6 +825,11 @@ void geometry_information::prepare_basics() {
} }
DEBB(DF_GEOM | DF_POLY, ("steps = ", psl_steps, " / ", single_step)); DEBB(DF_GEOM | DF_POLY, ("steps = ", psl_steps, " / ", single_step));
plevel = M_PI * single_step / psl_steps; plevel = M_PI * single_step / psl_steps;
if(hybrid::underlying == gEuclid && PURE) {
cgi.plevel = sqrt(3)/4.;
single_step = 1;
}
} }
set_sibling_limit(); set_sibling_limit();

View File

@ -321,7 +321,7 @@ void virtualRebase_cell(cell*& base, T& at, const U& check) {
template<class T, class U> template<class T, class U>
void virtualRebase(cell*& base, T& at, const U& check) { void virtualRebase(cell*& base, T& at, const U& check) {
if(nil && WDIM == 3 && nilv::nil_structure_index != 2) { if(nil && WDIM == 3 && nilv::nil_structure_index != 2 && !mhybrid) {
/** todo: implement for hex nil too */ /** todo: implement for hex nil too */
hyperpoint h = check(at); hyperpoint h = check(at);
auto step = [&] (int i) { auto step = [&] (int i) {

View File

@ -1602,7 +1602,8 @@ EX namespace hybrid {
tf = hdist0(hm)/2; tf = hdist0(hm)/2;
alpha = atan2(hm[1], hm[0]); alpha = atan2(hm[1], hm[0]);
}); });
return spin(alpha) * rots::uxpush(tf) * rots::uypush(he) * rots::uzpush(lev) * C0; if(nil) return spin(alpha) * xpush(tf*2) * ypush(he*2) * zpush(lev) * C0;
return spin(alpha) * twist::uxpush(tf) * twist::uypush(he) * twist::uzpush(lev) * C0;
#else #else
throw hr_exception(); throw hr_exception();
#endif #endif
@ -2341,6 +2342,10 @@ EX namespace twist {
} }
EX transmatrix lift_matrix(const transmatrix& T) { EX transmatrix lift_matrix(const transmatrix& T) {
if(nil) {
hyperpoint h(T[0][2], T[1][2], 0, 0); /* todo take rotate into account */
return nisot::translate(h);
}
hyperpoint d; hyperpoint d;
ld alpha, beta, distance; ld alpha, beta, distance;
transmatrix Spin; transmatrix Spin;
@ -2362,7 +2367,9 @@ EX namespace twist {
std::map<int, transmatrix> saved_matrices; std::map<int, transmatrix> saved_matrices;
transmatrix adj(cell *c1, int i) override { transmatrix adj(cell *c1, int i) override {
if(nil && i == c1->type-2) return zpush(-cgi.plevel);
if(nil && i == c1->type-1) return zpush(+cgi.plevel);
if(i == c1->type-2) return uzpush(-cgi.plevel) * spin(-2*cgi.plevel); if(i == c1->type-2) return uzpush(-cgi.plevel) * spin(-2*cgi.plevel);
if(i == c1->type-1) return uzpush(+cgi.plevel) * spin(+2*cgi.plevel); if(i == c1->type-1) return uzpush(+cgi.plevel) * spin(+2*cgi.plevel);
cell *c2 = c1->cmove(i); cell *c2 = c1->cmove(i);
@ -2391,6 +2398,8 @@ EX namespace twist {
} }
transmatrix ray_iadj(cell *c1, int i) override { transmatrix ray_iadj(cell *c1, int i) override {
if(nil && i == c1->type-2) return zpush(-cgi.plevel);
if(nil && i == c1->type-1) return zpush(+cgi.plevel);
if(i == c1->type-1) return uzpush(-cgi.plevel) * spin(-2*cgi.plevel); if(i == c1->type-1) return uzpush(-cgi.plevel) * spin(-2*cgi.plevel);
if(i == c1->type-2) return uzpush(+cgi.plevel) * spin(+2*cgi.plevel); if(i == c1->type-2) return uzpush(+cgi.plevel) * spin(+2*cgi.plevel);
cell *c2 = c1->cmove(i); cell *c2 = c1->cmove(i);