From e9c04e1e7798e963abc77a4125c6de4ef86025cc Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 13 Dec 2022 19:46:57 +0100 Subject: [PATCH] Sol/NIH geometries now have separate gc constants --- classes.cpp | 15 +++++++++------ geom-exp.cpp | 21 +++++++-------------- hyper.h | 6 +++--- nonisotropic.cpp | 19 +++++++++---------- rug.cpp | 2 +- shaders.cpp | 29 +++++++++++------------------ 6 files changed, 40 insertions(+), 52 deletions(-) diff --git a/classes.cpp b/classes.cpp index 6e2bfe64..1b29d760 100644 --- a/classes.cpp +++ b/classes.cpp @@ -752,7 +752,7 @@ enum eGeometry { gHalfBring, 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 }; @@ -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 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 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} }; @@ -919,20 +922,20 @@ EX vector ginf = { {"{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}, {"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}, {"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}, {"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}, {"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}, - {"3x1/2", "none", "stretched Solv", "3:1/2", 9, 3, (qBINARY|qSOL|qNIH), giSolNIH, {{7, 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), giSolN, {{7, 3}}, 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,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}, - {"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}, {"{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}, diff --git a/geom-exp.cpp b/geom-exp.cpp index 2f21369f..b8599f13 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -520,21 +520,14 @@ EX string geometry_name() { case gcSphere: return XLAT("spherical") + dim_name(); - case gcSolNIH: -#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 + case gcSol: return XLAT("Sol"); -#endif + + case gcNIH: + return XLAT("hyperbolic (3:2)"); + + case gcSolN: + return XLAT("Sol (3:2)"); case gcNil: return XLAT("Nil"); diff --git a/hyper.h b/hyper.h index d321c133..1a49434c 100644 --- a/hyper.h +++ b/hyper.h @@ -144,13 +144,13 @@ void addMessage(string s, char spamtype = 0); #define cgclass (cginf.cclass) #define euclid (cgclass == gcEuclid) #define sphere (cgclass == gcSphere) -#define sol (cgflags & qSOL) -#define nih (cgflags & qNIH) +#define sol (among(cgclass, gcSol, gcSolN)) +#define nih (among(cgclass, gcNIH, gcSolN)) #define nil (cgclass == gcNil) #define sl2 (cgclass == gcSL2) #define rotspace (geometry == gRotSpace) #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 nonorientable (cgflags & qNONORIENTABLE) #define elliptic (cgflags & qELLIPTIC) diff --git a/nonisotropic.cpp b/nonisotropic.cpp index a149cced..d99b7cee 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -50,11 +50,10 @@ EX } #if CAP_SOLV EX namespace sn { - EX bool in() { return cgclass == gcSolNIH; } + EX bool in() { return among(cgclass, gcSol, gcNIH, gcSolN); } - EX eGeometry geom() { - if(asonov::in()) return gSol; - else return geometry; + EX eGeometryClass geom() { + return cgclass; } #if HDR @@ -493,21 +492,21 @@ EX namespace sn { const ld l2 = log(2); const ld l3 = log(3); switch(geom()) { - case gSolN: + case gcSolN: return hpxyz3( -(velocity[2] * transported[0] + velocity[0] * transported[2]) * l2, (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, 0 ); - case gSol: + case gcSol: return hpxyz3( -velocity[2] * transported[0] - velocity[0] * 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]), 0 ); - case gNIH: + case gcNIH: return hpxyz3( (velocity[2] * transported[0] + velocity[0] * transported[2]) * l2, (velocity[2] * transported[1] + velocity[1] * transported[2]) * l3, @@ -676,9 +675,9 @@ EX namespace sn { EX tabled_inverses& get_tabled() { switch(geom()) { - case gSol: return solt; - case gNIH: return niht; - case gSolN: return sont; + case gcSol: return solt; + case gcNIH: return niht; + case gcSolN: return sont; default: throw hr_exception("not solnih"); } } diff --git a/rug.cpp b/rug.cpp index a2bc2cef..1b5b8914 100644 --- a/rug.cpp +++ b/rug.cpp @@ -859,7 +859,7 @@ bincode acd_bin(ld x) { bincode get_bincode(hyperpoint h) { 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; case gcHyperbolic: return acd_bin(hypot_d(3, h)); diff --git a/shaders.cpp b/shaders.cpp index a4ae5a8c..d3b02f3a 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -341,24 +341,17 @@ shared_ptr write_shader(flagtype shader_flags) { distfun = "length(t.xyz)"; switch(cgclass) { #if CAP_SOLV - case gcSolNIH: - switch(sn::geom()) { - case gSol: - 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; + case gcSol: + if(solv_all) { + vsh += "\n#define SOLV_ALL\n"; + } + vsh += sn::shader_symsol; + break; + case gcNIH: + vsh += sn::shader_nsym; + break; + case gcSolN: + vsh += sn::shader_nsymsol; break; #endif case gcNil: