1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-28 16:02:53 +00:00

Sol/NIH geometries now have separate gc constants

This commit is contained in:
Zeno Rogue 2022-12-13 19:46:57 +01:00
parent 557d3206a8
commit e9c04e1e77
6 changed files with 40 additions and 52 deletions

View File

@ -752,7 +752,7 @@ enum eGeometry {
gHalfBring, gHalfBring,
gGUARD}; gGUARD};
enum eGeometryClass { gcHyperbolic, gcEuclid, gcSphere, gcSolNIH, gcNil, gcProduct, gcSL2 }; enum eGeometryClass { gcHyperbolic, gcEuclid, gcSphere, gcSol, gcNIH, gcSolN, gcNil, gcProduct, gcSL2 };
enum class eVariation { bitruncated, pure, goldberg, irregular, dual, untruncated, warped, unrectified, subcubes, coxeter, dual_subcubes, bch, bch_oct }; enum class eVariation { bitruncated, pure, goldberg, irregular, dual, untruncated, warped, unrectified, subcubes, coxeter, dual_subcubes, bch, bch_oct };
@ -860,7 +860,10 @@ EX geometryinfo1 giEuclid3 = { gcEuclid, 3, 3, 4, {1,1, 1,0 } };
EX geometryinfo1 giHyperb3 = { gcHyperbolic, 3, 3, 4, {1,1, 1,-1} }; EX geometryinfo1 giHyperb3 = { gcHyperbolic, 3, 3, 4, {1,1, 1,-1} };
EX geometryinfo1 giSphere3 = { gcSphere, 3, 3, 4, {1,1, 1,+1} }; EX geometryinfo1 giSphere3 = { gcSphere, 3, 3, 4, {1,1, 1,+1} };
EX geometryinfo1 giSolNIH = { gcSolNIH, 3, 3, 4, {1,1, 1,0 } }; EX geometryinfo1 giSol = { gcSol, 3, 3, 4, {1,1, 1,0 } };
EX geometryinfo1 giNIH = { gcNIH, 3, 3, 4, {1,1, 1,0 } };
EX geometryinfo1 giSolN = { gcSolN, 3, 3, 4, {1,1, 1,0 } };
EX geometryinfo1 giNil = { gcNil, 3, 3, 4, {1,1, 1,0 } }; EX geometryinfo1 giNil = { gcNil, 3, 3, 4, {1,1, 1,0 } };
EX geometryinfo1 giProduct = { gcSL2, 3, 3, 4, {1,1, 1,0 } /* will be filled in product::configure() */ }; EX geometryinfo1 giProduct = { gcSL2, 3, 3, 4, {1,1, 1,0 } /* will be filled in product::configure() */ };
EX geometryinfo1 giSL2 = { gcSL2, 3, 3, 4, {1,1,-1,-1} }; EX geometryinfo1 giSL2 = { gcSL2, 3, 3, 4, {1,1,-1,-1} };
@ -919,20 +922,20 @@ EX vector<geometryinfo> ginf = {
{"{4,3,5}","field", "{4,3,5} field quotient space", "f435", 6, 5, qsSMALLBF | qDEPRECATED, giHyperb3, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, {"{4,3,5}","field", "{4,3,5} field quotient space", "f435", 6, 5, qsSMALLBF | qDEPRECATED, giHyperb3, {{SEE_ALL, SEE_ALL}}, eVariation::pure},
{"{5,3,4}","field", "{5,3,4} field quotient space", "f435", 12, 4, qsSMALLBF | qDEPRECATED, giHyperb3, {{SEE_ALL, SEE_ALL}}, eVariation::pure}, {"{5,3,4}","field", "{5,3,4} field quotient space", "f435", 12, 4, qsSMALLBF | qDEPRECATED, giHyperb3, {{SEE_ALL, SEE_ALL}}, eVariation::pure},
{"binary4","none", "standard binary tiling", "binary4", 5, 3, qBINARY, giHyperb2, {{7, 5}}, eVariation::pure}, {"binary4","none", "standard binary tiling", "binary4", 5, 3, qBINARY, giHyperb2, {{7, 5}}, eVariation::pure},
{"sol", "none", "Solv geometry", "sol", 8, 3, qBINARY|qSOL, giSolNIH, {{7, 5}}, eVariation::pure}, {"sol", "none", "Solv geometry", "sol", 8, 3, qBINARY|qSOL, giSol, {{7, 5}}, eVariation::pure},
{"kd2", "none", "kite-and-dart", "kd2", 4, 3, qKITE, giEuclid2, {{7, 7}}, eVariation::pure}, {"kd2", "none", "kite-and-dart", "kd2", 4, 3, qKITE, giEuclid2, {{7, 7}}, eVariation::pure},
{"kd3", "none", "kite-and-dart on horospheres", "kd3", 12, 3, qsBP, giHyperb3, {{7, 3}}, eVariation::pure}, {"kd3", "none", "kite-and-dart on horospheres", "kd3", 12, 3, qsBP, giHyperb3, {{7, 3}}, eVariation::pure},
{"nil", "none", "Nil geometry", "nil", 6, 3, qOPTQ, giNil, {{7, 5}}, eVariation::pure}, {"nil", "none", "Nil geometry", "nil", 6, 3, qOPTQ, giNil, {{7, 5}}, eVariation::pure},
{"product","none", "product space", "product", 7, 3, qHYBRID, giProduct, {{7, 3}}, eVariation::pure}, {"product","none", "product space", "product", 7, 3, qHYBRID, giProduct, {{7, 3}}, eVariation::pure},
{"twisted","none", "rotation space", "twisted", 7, 3, qHYBRID, giSL2, {{6, 4}}, eVariation::pure}, {"twisted","none", "rotation space", "twisted", 7, 3, qHYBRID, giSL2, {{6, 4}}, eVariation::pure},
{"ternary","none", "standard ternary tiling", "ternary", 6, 3, qBINARY, giHyperb2, {{6, 4}}, eVariation::pure}, {"ternary","none", "standard ternary tiling", "ternary", 6, 3, qBINARY, giHyperb2, {{6, 4}}, eVariation::pure},
{"3x2", "none", "stretched hyperbolic", "3:2", 11, 3, qBINARY|qNIH, giSolNIH, {{6, 3}}, eVariation::pure}, {"3x2", "none", "stretched hyperbolic", "3:2", 11, 3, qBINARY|qNIH, giNIH, {{6, 3}}, eVariation::pure},
{"3x1/2", "none", "stretched Solv", "3:1/2", 9, 3, (qBINARY|qSOL|qNIH), giSolNIH, {{7, 3}}, eVariation::pure}, {"3x1/2", "none", "stretched Solv", "3:1/2", 9, 3, (qBINARY|qSOL|qNIH), giSolN, {{7, 3}}, eVariation::pure},
{"{3,oo}", "none", "{3,∞} (infinite triangles)", "oox3", 3, OINF, qIDEAL, giHyperb2, {{7, 7}}, eVariation::pure}, {"{3,oo}", "none", "{3,∞} (infinite triangles)", "oox3", 3, OINF, qIDEAL, giHyperb2, {{7, 7}}, eVariation::pure},
{"{3,3,6}","none", "{3,3,6} hyperbolic honeycomb", "336", 4, 6, qIDEAL, giHyperb3, {{7, 2}}, eVariation::pure}, {"{3,3,6}","none", "{3,3,6} hyperbolic honeycomb", "336", 4, 6, qIDEAL, giHyperb3, {{7, 2}}, eVariation::pure},
{"{3,4,4}","none", "{3,4,4} hyperbolic honeycomb", "344", 8, 4, qIDEAL, giHyperb3, {{7, 2}}, eVariation::pure}, {"{3,4,4}","none", "{3,4,4} hyperbolic honeycomb", "344", 8, 4, qIDEAL, giHyperb3, {{7, 2}}, eVariation::pure},
{"{3,4,4}","Crystal", "4D crystal in H3", "Cryst3" , 8, 4, qIDEAL | qANYQ | qCRYSTAL, giHyperb3, {{7, 3}}, eVariation::pure}, {"{3,4,4}","Crystal", "4D crystal in H3", "Cryst3" , 8, 4, qIDEAL | qANYQ | qCRYSTAL, giHyperb3, {{7, 3}}, eVariation::pure},
{"cat", "cat", "Arnold's cat mapping torus", "cat", 12, 3, qBINARY | qSOL | qsBQ | qOPTQ | qCAT, giSolNIH, {{6, 4}}, eVariation::pure}, {"cat", "cat", "Arnold's cat mapping torus", "cat", 12, 3, qBINARY | qSOL | qsBQ | qOPTQ | qCAT, giSol, {{6, 4}}, eVariation::pure},
{"file", "none", "load from file", "file", 7, 3, 0, giEuclid2, {{7, 5}}, eVariation::pure}, {"file", "none", "load from file", "file", 7, 3, 0, giEuclid2, {{7, 5}}, eVariation::pure},
{"{4,oo}", "none", "{4,∞} (infinite squares)", "oox4", 4, OINF, qIDEAL, giHyperb2, {{5, 5}}, eVariation::pure}, {"{4,oo}", "none", "{4,∞} (infinite squares)", "oox4", 4, OINF, qIDEAL, giHyperb2, {{5, 5}}, eVariation::pure},
{"{5,3,4}","Crystal", "6D crystal in H3", "Cryst6" , 12, 4, qANYQ | qCRYSTAL, giHyperb3, {{7, 3}}, eVariation::pure}, {"{5,3,4}","Crystal", "6D crystal in H3", "Cryst6" , 12, 4, qANYQ | qCRYSTAL, giHyperb3, {{7, 3}}, eVariation::pure},

View File

@ -520,21 +520,14 @@ EX string geometry_name() {
case gcSphere: case gcSphere:
return XLAT("spherical") + dim_name(); return XLAT("spherical") + dim_name();
case gcSolNIH: case gcSol:
#if CAP_SOLV
switch(sn::geom()) {
case gSol:
return XLAT("Sol");
case gNIH:
return XLAT("hyperbolic (3:2)");
case gSolN:
return XLAT("Sol (3:2)");
default:
return "unknown";
}
#else
return XLAT("Sol"); return XLAT("Sol");
#endif
case gcNIH:
return XLAT("hyperbolic (3:2)");
case gcSolN:
return XLAT("Sol (3:2)");
case gcNil: case gcNil:
return XLAT("Nil"); return XLAT("Nil");

View File

@ -144,13 +144,13 @@ void addMessage(string s, char spamtype = 0);
#define cgclass (cginf.cclass) #define cgclass (cginf.cclass)
#define euclid (cgclass == gcEuclid) #define euclid (cgclass == gcEuclid)
#define sphere (cgclass == gcSphere) #define sphere (cgclass == gcSphere)
#define sol (cgflags & qSOL) #define sol (among(cgclass, gcSol, gcSolN))
#define nih (cgflags & qNIH) #define nih (among(cgclass, gcNIH, gcSolN))
#define nil (cgclass == gcNil) #define nil (cgclass == gcNil)
#define sl2 (cgclass == gcSL2) #define sl2 (cgclass == gcSL2)
#define rotspace (geometry == gRotSpace) #define rotspace (geometry == gRotSpace)
#define hyperbolic (cgclass == gcHyperbolic) #define hyperbolic (cgclass == gcHyperbolic)
#define nonisotropic (among(cgclass, gcSolNIH, gcNil, gcSL2)) #define nonisotropic (among(cgclass, gcSol, gcSolN, gcNIH, gcSL2, gcNil))
#define translatable (euclid || nonisotropic) #define translatable (euclid || nonisotropic)
#define nonorientable (cgflags & qNONORIENTABLE) #define nonorientable (cgflags & qNONORIENTABLE)
#define elliptic (cgflags & qELLIPTIC) #define elliptic (cgflags & qELLIPTIC)

View File

@ -50,11 +50,10 @@ EX }
#if CAP_SOLV #if CAP_SOLV
EX namespace sn { EX namespace sn {
EX bool in() { return cgclass == gcSolNIH; } EX bool in() { return among(cgclass, gcSol, gcNIH, gcSolN); }
EX eGeometry geom() { EX eGeometryClass geom() {
if(asonov::in()) return gSol; return cgclass;
else return geometry;
} }
#if HDR #if HDR
@ -493,21 +492,21 @@ EX namespace sn {
const ld l2 = log(2); const ld l2 = log(2);
const ld l3 = log(3); const ld l3 = log(3);
switch(geom()) { switch(geom()) {
case gSolN: case gcSolN:
return hpxyz3( return hpxyz3(
-(velocity[2] * transported[0] + velocity[0] * transported[2]) * l2, -(velocity[2] * transported[0] + velocity[0] * transported[2]) * l2,
(velocity[2] * transported[1] + velocity[1] * transported[2]) * l3, (velocity[2] * transported[1] + velocity[1] * transported[2]) * l3,
velocity[0] * transported[0] * exp(2*l2*at[2]) * l2 - velocity[1] * transported[1] * exp(-2*l3*at[2]) * l3, velocity[0] * transported[0] * exp(2*l2*at[2]) * l2 - velocity[1] * transported[1] * exp(-2*l3*at[2]) * l3,
0 0
); );
case gSol: case gcSol:
return hpxyz3( return hpxyz3(
-velocity[2] * transported[0] - velocity[0] * transported[2], -velocity[2] * transported[0] - velocity[0] * transported[2],
velocity[2] * transported[1] + velocity[1] * transported[2], velocity[2] * transported[1] + velocity[1] * transported[2],
velocity[0] * transported[0] * exp(2*at[2]) - velocity[1] * transported[1] * exp(-2*at[2]), velocity[0] * transported[0] * exp(2*at[2]) - velocity[1] * transported[1] * exp(-2*at[2]),
0 0
); );
case gNIH: case gcNIH:
return hpxyz3( return hpxyz3(
(velocity[2] * transported[0] + velocity[0] * transported[2]) * l2, (velocity[2] * transported[0] + velocity[0] * transported[2]) * l2,
(velocity[2] * transported[1] + velocity[1] * transported[2]) * l3, (velocity[2] * transported[1] + velocity[1] * transported[2]) * l3,
@ -676,9 +675,9 @@ EX namespace sn {
EX tabled_inverses& get_tabled() { EX tabled_inverses& get_tabled() {
switch(geom()) { switch(geom()) {
case gSol: return solt; case gcSol: return solt;
case gNIH: return niht; case gcNIH: return niht;
case gSolN: return sont; case gcSolN: return sont;
default: throw hr_exception("not solnih"); default: throw hr_exception("not solnih");
} }
} }

View File

@ -859,7 +859,7 @@ bincode acd_bin(ld x) {
bincode get_bincode(hyperpoint h) { bincode get_bincode(hyperpoint h) {
switch(ginf[gwhere].cclass) { switch(ginf[gwhere].cclass) {
case gcEuclid: case gcSolNIH: case gcNil: case gcProduct: case gcSL2: case gcEuclid: case gcSol: case gcNIH: case gcSolN: case gcNil: case gcProduct: case gcSL2:
return acd_bin(h[0]) + acd_bin(h[1]) * sY + acd_bin(h[2]) * sZ; return acd_bin(h[0]) + acd_bin(h[1]) * sY + acd_bin(h[2]) * sZ;
case gcHyperbolic: case gcHyperbolic:
return acd_bin(hypot_d(3, h)); return acd_bin(hypot_d(3, h));

View File

@ -341,24 +341,17 @@ shared_ptr<glhr::GLprogram> write_shader(flagtype shader_flags) {
distfun = "length(t.xyz)"; distfun = "length(t.xyz)";
switch(cgclass) { switch(cgclass) {
#if CAP_SOLV #if CAP_SOLV
case gcSolNIH: case gcSol:
switch(sn::geom()) { if(solv_all) {
case gSol: vsh += "\n#define SOLV_ALL\n";
if(solv_all) {
vsh += "\n#define SOLV_ALL\n";
}
vsh += sn::shader_symsol;
break;
case gNIH:
vsh += sn::shader_nsym;
break;
case gSolN:
vsh += sn::shader_nsymsol;
break;
default:
println(hlog, "error: unknown sn geometry");
} }
treset = true; vsh += sn::shader_symsol;
break;
case gcNIH:
vsh += sn::shader_nsym;
break;
case gcSolN:
vsh += sn::shader_nsymsol;
break; break;
#endif #endif
case gcNil: case gcNil: