updir and expansion functions in binarytiling

This commit is contained in:
Zeno Rogue 2019-07-25 23:06:09 +02:00
parent 0908d1d974
commit b2e8a869cb
3 changed files with 24 additions and 4 deletions

View File

@ -591,6 +591,7 @@ void buildEquidistant(cell *c) {
#if CAP_BT
if(binarytiling) {
int skip = geometry == gHoroRec ? 3 : 2;
int up = binary::updir();
if(c->landparam == 1)
c->landflags = (hrand(100) < 20);
else if(WDIM == 2 && c->type == 6 && (c->landparam % 2) && c->move(binary::bd_down) && c->move(binary::bd_down)->landflags)
@ -600,9 +601,9 @@ void buildEquidistant(cell *c) {
if(c->move(d) && c->move(d)->landflags)
c->landflags = 1;
}
else if(WDIM == 3 && c->landparam % skip != 1 && c->move(S7-1) && c->move(S7-1)->landflags)
else if(WDIM == 3 && c->landparam % skip != 1 && c->move(up) && c->move(up)->landflags)
c->landflags = 1;
else if(WDIM == 3 && c->landparam % skip == 1 && c->move(S7-1) && c->move(S7-1)->c.spin(S7-1) == (c->c.spin(S7-1)) && c->move(S7-1)->move(S7-1)->landflags)
else if(WDIM == 3 && c->landparam % skip == 1 && c->move(up) && c->move(up)->c.spin(up) == (c->c.spin(up)) && c->move(up)->move(up)->landflags)
c->landflags = 1;
if(c->landflags) c->wall = (WDIM == 3 ? waTrunk3 : waTrunk);
}
@ -1535,7 +1536,7 @@ void moreBigStuff(cell *c) {
if(i > 1) c->wall = waColumn;
}
else if(geometry == gHoroTris || geometry == gHoroRec) {
if(c->c.spin(S7-1) != 0) c->wall = waColumn;
if(c->c.spin(binary::updir()) != 0) c->wall = waColumn;
}
else if(geometry == gKiteDart3) {
if(kite::getshape(c->master) == kite::pKite) c->wall = waColumn;

View File

@ -478,6 +478,24 @@ namespace binary {
return (use_direct >> dir) & 1;
}
ld expansion() {
switch(geometry) {
case gHoroRec:
return sqrt(2);
case gHoroHex:
return sqrt(3);
case gKiteDart3:
return (sqrt(5)+1)/2;
default:
return 2;
}
}
int updir() {
if(penrose) return 4;
return S7-1;
}
void build_tmatrix() {
if(among(geometry, gBinaryTiling, gSol)) return; // unused
use_direct = (1 << (S7-1)) - 1;

View File

@ -2523,7 +2523,8 @@ void setdist(cell *c, int d, cell *from) {
cell *cseek = c;
int step = 0;
if(geometry == gHoroHex) z *= 2;
while(z < 3.999 && step < 10) cseek = cseek->cmove(penrose ? 4 : S7-1), z *= 2;
ld scale = binary::expansion();
while(z < 3.999 && step < 10) cseek = cseek->cmove(binary::updir()), z *= scale;
if(cseek->master->emeraldval) setland(c, eLand(cseek->master->emeraldval));
}