mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-02 12:19:18 +00:00
fixed the binary tiling to use correct straight lines on the vertical edges; also grid lines now work correctly
This commit is contained in:
parent
f9552eb74e
commit
62ffefc0cc
@ -1027,7 +1027,7 @@ EX int celldistance3(heptagon *c1, heptagon *c2) {
|
||||
EX int celldistance3(cell *c1, cell *c2) { return celldistance3(c1->master, c2->master); }
|
||||
|
||||
EX hyperpoint get_horopoint(ld y, ld x) {
|
||||
return xpush(-y) * bt::parabolic(x*2) * C0;
|
||||
return bt::parabolic(x*2) * xpush(-y) * C0;
|
||||
}
|
||||
|
||||
EX hyperpoint get_horopoint(hyperpoint h) {
|
||||
@ -1035,17 +1035,16 @@ EX hyperpoint get_horopoint(hyperpoint h) {
|
||||
}
|
||||
|
||||
EX hyperpoint get_corner_horo_coordinates(cell *c, int i) {
|
||||
ld yx = log(2) / 2;
|
||||
ld yy = yx;
|
||||
ld xx = 1 / sqrt(2)/2;
|
||||
ld yy = log(2) / 2;
|
||||
ld xx = 1 / 2.;
|
||||
switch(geometry) {
|
||||
case gBinaryTiling:
|
||||
switch(gmod(i, c->type)) {
|
||||
case 0: return point2(-yy, xx);
|
||||
case 1: return point2(yy, 2*xx);
|
||||
case 2: return point2(yy, xx);
|
||||
case 3: return point2(yy, -xx);
|
||||
case 4: return point2(yy, -2*xx);
|
||||
case 1: return point2(yy, xx);
|
||||
case 2: return point2(yy, xx/2);
|
||||
case 3: return point2(yy, -xx/2);
|
||||
case 4: return point2(yy, -xx);
|
||||
case 5: return point2(-yy, -xx);
|
||||
case 6: return point2(-yy, 0);
|
||||
default: return point2(0, 0);
|
||||
@ -1053,9 +1052,9 @@ EX hyperpoint get_corner_horo_coordinates(cell *c, int i) {
|
||||
|
||||
case gBinary4:
|
||||
switch(gmod(i, c->type)) {
|
||||
case 0: return point2(yy, -2*xx);
|
||||
case 0: return point2(yy, -xx);
|
||||
case 1: return point2(yy, +0*xx);
|
||||
case 2: return point2(yy, +2*xx);
|
||||
case 2: return point2(yy, +xx);
|
||||
case 3: return point2(-yy, xx);
|
||||
case 4: return point2(-yy, -xx);
|
||||
default: return point2(0, 0);
|
||||
@ -1063,12 +1062,11 @@ EX hyperpoint get_corner_horo_coordinates(cell *c, int i) {
|
||||
|
||||
case gTernary:
|
||||
yy = log(3) / 2;
|
||||
xx = 1 / sqrt(3) / 2;
|
||||
switch(gmod(i, c->type)) {
|
||||
case 0: return point2(yy, -3*xx);
|
||||
case 1: return point2(yy, -1*xx);
|
||||
case 2: return point2(yy, +1*xx);
|
||||
case 3: return point2(yy, +3*xx);
|
||||
case 0: return point2(yy, -xx);
|
||||
case 1: return point2(yy, -xx/3);
|
||||
case 2: return point2(yy, +xx/3);
|
||||
case 3: return point2(yy, +xx);
|
||||
case 4: return point2(-yy, xx);
|
||||
case 5: return point2(-yy, -xx);
|
||||
default: return point2(0, 0);
|
||||
|
@ -905,20 +905,22 @@ void celldrawer::draw_grid() {
|
||||
}
|
||||
#endif
|
||||
#if CAP_BT
|
||||
else if(bt::in() && WDIM == 2 && geometry != gTernary) {
|
||||
ld yx = log(2) / 2;
|
||||
ld yy = yx;
|
||||
ld xx = 1 / sqrt(2)/2;
|
||||
queueline(V * bt::get_horopoint(-yy, xx), V * bt::get_horopoint(yy, 2*xx), gridcolor(c, c->move(bt::bd_right)), prec);
|
||||
auto horizontal = [&] (ld y, ld x1, ld x2, int steps, int dir) {
|
||||
if(vid.linequality > 0) steps <<= vid.linequality;
|
||||
if(vid.linequality < 0) steps >>= -vid.linequality;
|
||||
for(int i=0; i<=steps; i++) curvepoint(bt::get_horopoint(y, x1 + (x2-x1) * i / steps));
|
||||
queuecurve(V, gridcolor(c, c->move(dir)), 0, PPR::LINE);
|
||||
};
|
||||
horizontal(yy, 2*xx, xx, 4, bt::bd_up_right);
|
||||
horizontal(yy, xx, -xx, 8, bt::bd_up);
|
||||
horizontal(yy, -xx, -2*xx, 4, bt::bd_up_left);
|
||||
else if(bt::in() && WDIM == 2) {
|
||||
for(int t=0; t<c->type; t++) {
|
||||
auto h0 = bt::get_corner_horo_coordinates(c, t);
|
||||
auto h1 = bt::get_corner_horo_coordinates(c, t+1);
|
||||
int steps = 12 * abs(h0[1] - h1[1]);
|
||||
if(!steps) {
|
||||
gridline(V, bt::get_horopoint(h0), bt::get_horopoint(h1), gridcolor(c, c->move(t)), prec);
|
||||
}
|
||||
else {
|
||||
if(vid.linequality > 0) steps <<= vid.linequality;
|
||||
if(vid.linequality < 0) steps >>= -vid.linequality;
|
||||
auto step = (h1 - h0) / steps;
|
||||
for(int i=0; i<=steps; i++) curvepoint(bt::get_horopoint(h0 + i * step));
|
||||
queuecurve(V, gridcolor(c, c->move(t)), 0, PPR::LINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if(isWarped(c) && has_nice_dual()) {
|
||||
|
@ -639,10 +639,10 @@ EX hyperpoint nearcorner(cell *c, int i) {
|
||||
ld yx = log(2) / 2;
|
||||
ld yy = yx;
|
||||
hyperpoint neis[5];
|
||||
neis[0] = bt::get_horopoint(2*yy, -0.5);
|
||||
neis[1] = bt::get_horopoint(2*yy, +0.5);
|
||||
neis[0] = bt::get_horopoint(2*yy, -0.25);
|
||||
neis[1] = bt::get_horopoint(2*yy, +0.25);
|
||||
neis[2] = bt::get_horopoint(0, 1);
|
||||
neis[3] = bt::get_horopoint(-2*yy, c->master->zebraval ? -0.25 : +0.25);
|
||||
neis[3] = bt::get_horopoint(-2*yy, c->master->zebraval ? -0.5 : +0.5);
|
||||
neis[4] = bt::get_horopoint(0, -1);
|
||||
return neis[i];
|
||||
}
|
||||
@ -650,11 +650,11 @@ EX hyperpoint nearcorner(cell *c, int i) {
|
||||
ld yx = log(3) / 2;
|
||||
ld yy = yx;
|
||||
hyperpoint neis[6];
|
||||
neis[0] = bt::get_horopoint(2*yy, -1);
|
||||
neis[0] = bt::get_horopoint(2*yy, -1/3.);
|
||||
neis[1] = bt::get_horopoint(2*yy, +0);
|
||||
neis[2] = bt::get_horopoint(2*yy, +1);
|
||||
neis[2] = bt::get_horopoint(2*yy, +1/3.);
|
||||
neis[3] = bt::get_horopoint(0, 1);
|
||||
neis[4] = bt::get_horopoint(-2*yy, c->master->zebraval / 3.);
|
||||
neis[4] = bt::get_horopoint(-2*yy, c->master->zebraval);
|
||||
neis[5] = bt::get_horopoint(0, -1);
|
||||
return neis[i];
|
||||
}
|
||||
@ -674,13 +674,13 @@ EX hyperpoint nearcorner(cell *c, int i) {
|
||||
// ld xx = 1 / sqrt(2)/2;
|
||||
hyperpoint neis[7];
|
||||
neis[0] = bt::get_horopoint(0, 1);
|
||||
neis[1] = bt::get_horopoint(yy*2, 1);
|
||||
neis[1] = bt::get_horopoint(yy*2, 0.5);
|
||||
neis[2] = bt::get_horopoint(yy*2, 0);
|
||||
neis[3] = bt::get_horopoint(yy*2, -1);
|
||||
neis[3] = bt::get_horopoint(yy*2, -0.5);
|
||||
neis[4] = bt::get_horopoint(0, -1);
|
||||
if(c->type == 7)
|
||||
neis[5] = bt::get_horopoint(-yy*2, -.5),
|
||||
neis[6] = bt::get_horopoint(-yy*2, +.5);
|
||||
neis[5] = bt::get_horopoint(-yy*2, -1),
|
||||
neis[6] = bt::get_horopoint(-yy*2, +1);
|
||||
else
|
||||
neis[5] = bt::get_horopoint(-yy*2, 0);
|
||||
return neis[i];
|
||||
|
Loading…
Reference in New Issue
Block a user