1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-02-03 04:39:17 +00:00

octagon geometry

This commit is contained in:
Zeno Rogue 2019-01-11 02:22:19 +01:00
parent ac0430d350
commit 8c5b62e309
6 changed files with 42 additions and 5 deletions

View File

@ -84,6 +84,7 @@ hrmap_hyperbolic::hrmap_hyperbolic() {
int spherecells() {
if(S7 == 5) return (elliptic?6:12);
if(S7 == 4) return (elliptic?3:6);
if(S7 == 3 && S3 == 4) return (elliptic?4:8);
if(S7 == 3) return 4;
if(S7 == 2) return (elliptic?1:2);
if(S7 == 1) return 1;
@ -115,8 +116,35 @@ struct hrmap_spherical : hrmap {
siblings = {1, 0, 10, 4, 3, 8, 9, 11, 5, 6, 2, 7};
else
siblings = {1, 0, 3, 2, 5, 4};
if(S7 == 3 && S3 == 4) {
for(int i=0; i<8; i++) {
dodecahedron[i]->move(0) = dodecahedron[i^1];
dodecahedron[i]->c.setspin(0, 0, false);
dodecahedron[i]->move(1) = dodecahedron[i^2];
dodecahedron[i]->c.setspin(1, 1, false);
dodecahedron[i]->move(2) = dodecahedron[i^4];
dodecahedron[i]->c.setspin(2, 2, false);
}
for(int i=0; i<8; i++) {
int s = (i&1)+((i&2)>>1)+((i&4)>>2);
if((s&1) == 1) {
swap(dodecahedron[i]->move(1), dodecahedron[i]->move(2));
int a = dodecahedron[i]->c.spin(1);
int b = dodecahedron[i]->c.spin(2);
dodecahedron[i]->c.setspin(1, b, false);
dodecahedron[i]->c.setspin(2, a, false);
dodecahedron[i]->move(1)->c.setspin(b, 1, false);
dodecahedron[i]->move(2)->c.setspin(a, 2, false);
}
}
for(int i=0; i<8; i++)
for(int j=0; j<3; j++)
if(dodecahedron[i]->move(j)->move(dodecahedron[i]->c.spin(j)) != dodecahedron[i])
println(hlog, "8");
}
if(S7 == 4 && elliptic) {
else if(S7 == 4 && elliptic) {
for(int i=0; i<3; i++) {
int i1 = (i+1)%3;
int i2 = (i+2)%3;
@ -197,6 +225,7 @@ struct hrmap_spherical : hrmap {
for(int i=0; i<spherecells(); i++) for(int k=0; k<S7; k++) {
heptspin hs(dodecahedron[i], k, false);
heptspin hs2 = hs + wstep + (S7-1) + wstep + (S7-1) + wstep + (S7-1);
if(S3 == 4) hs2 = hs2 + wstep + (S7-1);
if(hs2.at != hs.at) printf("error %d,%d\n", i, k);
}
for(int i=0; i<spherecells(); i++) verifycells(dodecahedron[i]);

View File

@ -1694,6 +1694,7 @@ vector<geometryinfo> ginf = {
{"Schmutz's M(3)", "M3", 12, 3, qsSMALL, gcHyperbolic, 0x20400, {{4, 2}}, eVariation::bitruncated},
{"Schmutz's M(4)", "M4", 12, 3, qsSMALL, gcHyperbolic, 0x20600, {{4, 2}}, eVariation::bitruncated},
{"dimensional crystal", "Crystal", 6, 4, qANYQ, gcHyperbolic, 0x28000, {{5, 3}}, eVariation::pure},
{"octahedron", "4x3", 3, 4, qsSMALLB, gcSphere, 0x28200, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated},
};
// remember to match the following mask when specifying codes for extra geometries: 0x78600

View File

@ -209,7 +209,7 @@ enum eLand { laNone, laBarrier, laCrossroads, laDesert, laIce, laCaves, laJungle
enum eGeometry {
gNormal, gEuclid, gSphere, gElliptic, gZebraQuotient, gFieldQuotient, gTorus, gOctagon, g45, g46, g47, gSmallSphere, gTinySphere, gEuclidSquare, gSmallElliptic,
gKleinQuartic, gBolza, gBolza2, gMinimal, gBinaryTiling, gArchimedean,
gMacbeath, gBring, gSchmutzM2, gSchmutzM3, gCrystal,
gMacbeath, gBring, gSchmutzM2, gSchmutzM3, gCrystal, gOctahedron,
gGUARD};
enum eGeometryClass { gcHyperbolic, gcEuclid, gcSphere };

View File

@ -483,7 +483,7 @@ namespace hr { namespace gp {
#define corner_coords (S3==3 ? corner_coords6 : corner_coords4)
hyperpoint cornmul(const transmatrix& corners, const hyperpoint& c) {
if(sphere) {
if(sphere && S3 == 3) {
ld cmin = c[0] * c[1] * c[2] * (6 - S7);
return corners * hpxyz(c[0] + cmin, c[1] + cmin, c[2] + cmin);
}

View File

@ -26,9 +26,16 @@ hstate transition(hstate s, int dir) {
if(S7 == 4) {
if(s == hsOrigin) return dir == 0 ? hsB0 : hsB1;
}
if(S7 == 3) {
if(S7 == 3 && S3 == 3) {
if(s == hsOrigin) return hsB1;
}
if(S7 == 3 && S3 == 4) {
if(s == hsOrigin) return dir == 0 ? hsA0 : hsA1;
if(s == hsA0 && dir == 1) return hsB0;
if(s == hsA1 && dir == 1) return hsB1;
if(s == hsB0 && dir == 2) return hsC;
return hsError;
}
if(s == hsOrigin) return dir == 0 ? hsA0 : hsA1;
if(s == hsA0 && dir == 2) return hsB0;
if(s == hsA1 && dir == 2) return hsB1;

View File

@ -736,7 +736,7 @@ namespace patterns {
if(IRREGULAR || archimedean || binarytiling) si.symmetries = 1;
else if(a46) val46(c, si, sub, pat);
else if(a38) val38(c, si, sub, pat);
else if(sphere) valSibling(c, si, sub, pat);
else if(sphere && S3 == 3) valSibling(c, si, sub, pat);
else if(euclid4) valEuclid4(c, si, sub);
else if(euclid) valEuclid6(c, si, sub);
else if(a4) val457(c, si, sub);