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

3d:: horo-rec geometry

This commit is contained in:
Zeno Rogue 2019-03-12 02:40:15 +01:00
parent c25561bb91
commit 678747ceff
8 changed files with 75 additions and 8 deletions

View File

@ -80,6 +80,8 @@ namespace binary {
return h1;
}
ld hororec_scale = 0.25;
heptagon *build(heptagon *parent, int d, int d1, int t, int side, int delta) {
auto h = buildHeptagon1(tailored_alloc<heptagon> (t), parent, d, hsOrigin, d1);
h->distance = parent->distance + delta;
@ -218,6 +220,32 @@ namespace binary {
return path(h, 7, 6, {8, 7, parent->c.spin(8) ^ 2});
}
}
case gHoroRec: {
switch(d) {
case 0: case 1:
return build3(parent, d, 6, 1);
case 6:
return build3(parent, 6, hrand(2), -1);
case 2:
parent->cmove(6);
if(parent->c.spin(6) == 0)
return path(h, 2, 4, {6, 1});
else
return path(h, 2, 4, {6, 3, 0});
case 4:
parent->cmove(6);
if(parent->c.spin(6) == 0)
return path(h, 4, 2, {6, 5, 1});
else
return path(h, 4, 2, {6, 0});
case 3:
parent->cmove(6);
return path(h, 3, 5, {6, 4, parent->c.spin(6)});
case 5:
parent->cmove(6);
return path(h, 5, 3, {6, 2, parent->c.spin(6)});
}
}
case gHoroTris: {
switch(d) {
case 0: case 1: case 2: case 3:
@ -348,6 +376,17 @@ namespace binary {
direct_tmatrix[5] = parabolic3(1, r3/3) * cspin(1,2,M_PI);
direct_tmatrix[6] = parabolic3(-1, r3/3) * cspin(1,2,M_PI);
}
if(geometry == gHoroRec) {
ld r2 = sqrt(2);
ld l = -log(2)/2;
ld z = hororec_scale;
direct_tmatrix[0] = parabolic3(0, -z) * xpush(l) * cspin(2,1,M_PI/2);
direct_tmatrix[1] = parabolic3(0, +z) * xpush(l) * cspin(2,1,M_PI/2);
direct_tmatrix[2] = parabolic3(+2*r2*z, 0);
direct_tmatrix[3] = parabolic3(0, +4*z);
direct_tmatrix[4] = parabolic3(-2*r2*z, 0);
direct_tmatrix[5] = parabolic3(0, -4*z);
}
for(int i=0; i<S7-1; i++)
inverse_tmatrix[i] = inverse(direct_tmatrix[i]);
}

View File

@ -1762,7 +1762,7 @@ vector<geometryinfo> ginf = {
{"{8,3}", "Bolza", "Bolza Surface", "Bolza", 8, 3, qsDOCKS, gcHyperbolic, 0x18200, {{6, 4}}, eVariation::bitruncated},
{"{8,3}", "Bolza2", "Bolza Surface x2", "Bolza2", 8, 3, qsDOCKS, gcHyperbolic, 0x18400, {{6, 4}}, eVariation::bitruncated},
{"{7,3}", "minimal", "minimal quotient", "minimal", 7, 3, qsSMALLN, gcHyperbolic, 0x18600, {{7, 5}}, eVariation::bitruncated},
{"binary","none", "variant of the binary tiling", "binary", 7, 3, 0, gcHyperbolic, 0, {{7, 5}}, eVariation::pure},
{"binary","none", "variant of the binary tiling", "binary", 7, 3, qBINARY, gcHyperbolic, 0, {{7, 5}}, eVariation::pure},
{"Arch", "none", "Archimedean", "A", 7, 3, 0, gcHyperbolic, 0, {{7, 5}}, eVariation::pure},
{"{7,3}", "Macbeath", "Macbeath Surface", "Macbeath", 7, 3, qsSMALL, gcHyperbolic, 0x20000, {{7, 5}}, eVariation::bitruncated},
{"{5,4}", "Bring", "Bring's Surface", "Bring", 5, 4, qsSMALL, gcHyperbolic, 0x20200, {{6, 4}}, eVariation::bitruncated},
@ -1770,7 +1770,7 @@ vector<geometryinfo> ginf = {
{"{12,3}","M4", "Schmutz's M(4)", "M4", 12, 3, qsSMALL, gcHyperbolic, 0x20600, {{4, 2}}, eVariation::bitruncated},
{"{6,4}", "Crystal", "dimensional crystal", "Crystal", 6, 4, qANYQ, gcHyperbolic, 0x28000, {{5, 3}}, eVariation::pure},
{"{3,4}", "none", "{3,4} (octahedron)", "4x3", 3, 4, qsSMALLB, gcSphere, 0x28200, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated},
{"bin{4,4}", "none", "{4,4} on horospheres", "bin44", 9, 3, 0, gcHyperbolic, 0x30000, {{7, 3}}, eVariation::pure},
{"bin{4,4}", "none", "{4,4} on horospheres", "bin44", 9, 3, qBINARY, gcHyperbolic, 0x30000, {{7, 3}}, eVariation::pure},
{"{4,3,4}","none", "{4,3,4} cube tiling", "433", 6, 4, 0, gcEuclid, 0x30200, {{7, 5}}, eVariation::pure},
{"{5,3,3}","none", "{5,3,3} 120-cell", "533", 12, 3, qsSMALLB, gcSphere, 0x30400, {{SEE_ALL, SEE_ALL}}, eVariation::pure},
{"{5,3,3}", "elliptic","{5,3,3} 120-cell (elliptic space)", "e533", 12, 3, qsSMALLBE, gcSphere, 0x30600, {{SEE_ALL, SEE_ALL}}, eVariation::pure},
@ -1787,7 +1787,8 @@ vector<geometryinfo> ginf = {
{"{3,4,3}","elliptic","{3,4,3} 24-cell (elliptic)", "e343", 8, 3, qsSMALLBE, gcSphere, 0x39600, {{SEE_ALL, SEE_ALL}}, eVariation::pure},
{"{3,3,5}","none", "{3,3,5} 600-cell", "335", 4, 3, qsSMALLB, gcSphere, 0x30800, {{SEE_ALL, SEE_ALL}}, eVariation::pure},
{"{3,3,5}","elliptic","{3,3,5} 600-cell (elliptic)", "e335", 4, 3, qsSMALLBE, gcSphere, 0x31800, {{SEE_ALL, SEE_ALL}}, eVariation::pure},
{"bin{3,6}", "none", "{3,6} on horospheres", "bin36", 8, 3, 0, gcHyperbolic, 0x40000, {{7, 3}}, eVariation::pure},
{"bin{3,6}", "none", "{3,6} on horospheres", "bin36", 8, 3, qBINARY, gcHyperbolic, 0x40000, {{7, 3}}, eVariation::pure},
{"bin-rect", "none", "rectangles on horospheres", "bin44/2", 7, 3, qBINARY, gcHyperbolic, 0x40200, {{7, 3}}, eVariation::pure},
};
// bits: 9, 10, 15, 16, (reserved for later) 17, 18

View File

@ -222,7 +222,7 @@ enum eGeometry {
gCell16, gECell16,
gCell24, gECell24,
gCell600, gECell600,
gHoroTris,
gHoroTris, gHoroRec,
gGUARD};
enum eGeometryClass { gcHyperbolic, gcEuclid, gcSphere };
@ -254,6 +254,8 @@ static const flagtype qZEBRA = 64;
static const flagtype qELLIPTIC = 128;
static const flagtype qBINARY = 256;
// note: dnext assumes that x&7 equals 7
static const int SEE_ALL = 50;
static const int FORBIDDEN = -1;

View File

@ -383,6 +383,7 @@ void initConfig() {
addsaver(sightranges[gCell600], "sight-600cell", 2 * M_PI);
addsaver(sightranges[gECell600], "sight-600cell-elliptic", M_PI);
addsaver(sightranges[gHoroTris], "sight-horotris", 3);
addsaver(sightranges[gHoroRec], "sight-hororec", 2);
addsaver(smooth_scrolling, "smooth-scrolling", false);
addsaver(mouseaim_sensitivity, "mouseaim_sensitivity", 0.01);

View File

@ -186,6 +186,7 @@ void precalc() {
#endif
#if CAP_BT
if(binarytiling) hexvdist = rhexf = 1, tessf = 1, scalefactor = 1, crossf = hcrossf7;
if(geometry == gHoroRec) hexvdist = rhexf = .5, tessf = .5, scalefactor = .5, crossf = hcrossf7/2;
#endif
#if CAP_BT && MAXMDIM >= 4
if(binarytiling && DIM == 3) binary::build_tmatrix();

View File

@ -4798,7 +4798,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
for(int a=0; a<c->type; a++)
if(c->move(a) && !isWall3(c->move(a), dummy)) {
if(a < 4 && binarytiling && celldistAlt(c) >= celldistAlt(viewctr.at->c7)) continue;
if(a < 4 && among(geometry, gHoroTris, gBinary3) && celldistAlt(c) >= celldistAlt(viewctr.at->c7)) continue;
if(a < 2 && among(geometry, gHoroRec) && celldistAlt(c) >= celldistAlt(viewctr.at->c7)) continue;
if(qfi.fshape && wmescher) {
auto& poly = queuepoly(V, shWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF));
poly.tinf = &qfi.fshape->tinf3;

View File

@ -94,7 +94,7 @@ void addMessage(string s, char spamtype = 0);
#define weirdhyperbolic ((S7 > 7 || S3 > 3 || !STDVAR || binarytiling || archimedean) && hyperbolic)
#define stdhyperbolic (S7 == 7 && S3 == 3 && STDVAR && !binarytiling && !archimedean)
#define binarytiling (geometry == gBinaryTiling || geometry == gBinary3 || geometry == gHoroTris)
#define binarytiling (ginf[geometry].flags & qBINARY)
#define archimedean (geometry == gArchimedean)
#define eubinary (euclid || binarytiling || geometry == gCrystal)
@ -1524,7 +1524,7 @@ bool bearsCamelot(eLand l);
extern bool safety;
#define SAGEMELT .1
#define TEMPLE_EACH ((DIM == 3 && binarytiling) ? 2 : geometry == gSpace435 ? 4 : (DIM == 3 && hyperbolic) ? 3 : 6)
#define TEMPLE_EACH (geometry == gHoroRec ? 3 : (DIM == 3 && binarytiling) ? 2 : geometry == gSpace435 ? 4 : (DIM == 3 && hyperbolic) ? 3 : 6)
#define PT(x, y) ((tactic::on || quotient == 2 || daily::on) ? (y) : inv::on ? min(2*(y),x) : (x))
#define ROCKSNAKELENGTH 50
#define WORMLENGTH 15

View File

@ -2446,6 +2446,28 @@ void create_wall3d() {
make_wall(7, {d0+down, d1+down, d2+down});
}
if(geometry == gHoroRec) {
ld r2 = sqrt(2);
ld z = hororec_scale;
hyperpoint a00 = point3(-r2*z,-2*z,-.5);
hyperpoint a01 = point3(+r2*z,-2*z,-.5);
hyperpoint a10 = point3(-r2*z, 0*z,-.5);
hyperpoint a11 = point3(+r2*z, 0*z,-.5);
hyperpoint a20 = point3(-r2*z,+2*z,-.5);
hyperpoint a21 = point3(+r2*z,+2*z,-.5);
hyperpoint down = point3(0,0,1);
make_wall(0, make4(a00, a01, a10), true);
make_wall(1, make4(a10, a11, a20), true);
make_wall(2, make5(a01, a21, a01+down));
make_wall(3, make4(a21, a20, a21+down));
make_wall(4, make5(a20, a00, a20+down));
make_wall(5, make5(a00, a01, a00+down));
make_wall(6, make4(a00+down, a01+down, a20+down));
}
if(DIM == 3 && euclid && S7 == 6) {
for(int w=0; w<6; w++) {
vector<hyperpoint> vertices;