mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-20 00:17:39 +00:00
used cyclefix and raddif in more places; (c)spin90, (c)spin180 and spin180 functions; rephrased M_PI in terms of TAU and x._deg when applicable
This commit is contained in:
54
reg3.cpp
54
reg3.cpp
@@ -216,14 +216,14 @@ EX namespace reg3 {
|
||||
|
||||
if(1) {
|
||||
dynamicval<eGeometry> dg(geometry, gSphere);
|
||||
angle_between_faces = edge_of_triangle_with_angles(2*M_PI/mid, M_PI/face, M_PI/face);
|
||||
angle_between_faces = edge_of_triangle_with_angles(TAU/mid, M_PI/face, M_PI/face);
|
||||
|
||||
h0 = xtangent(1);
|
||||
h1 = cspin(0, 1, angle_between_faces) * h0;
|
||||
h2 = cspin(1, 2, 2*M_PI/face) * h1;
|
||||
h3 = cspin(1, 2, -2*M_PI/face) * h1;
|
||||
h2 = cspin(1, 2, TAU/face) * h1;
|
||||
h3 = cspin(1, 2, -TAU/face) * h1;
|
||||
|
||||
hcrossf = edge_of_triangle_with_angles(M_PI/2, M_PI/mid, M_PI/face);
|
||||
hcrossf = edge_of_triangle_with_angles(90._deg, M_PI/mid, M_PI/face);
|
||||
|
||||
h012 = cspin(1, 2, M_PI/face) * cspin(0, 1, hcrossf) * h0;
|
||||
h013 = cspin(1, 2, -M_PI/face) * cspin(0, 1, hcrossf) * h0;
|
||||
@@ -245,7 +245,7 @@ EX namespace reg3 {
|
||||
u = normalize(u);
|
||||
|
||||
hyperpoint h = C0 * face;
|
||||
for(int i=0; i<face; i++) h += d * (cspin(1, 2, M_PI*2*i/face) * h012);
|
||||
for(int i=0; i<face; i++) h += d * (cspin(1, 2, TAU*i/face) * h012);
|
||||
h = normalize(h);
|
||||
|
||||
hyperpoint h2 = rspintox(h) * xpush0(2 * hdist0(h));
|
||||
@@ -276,25 +276,25 @@ EX namespace reg3 {
|
||||
hyperpoint v2 = C0 + klein_scale * h012;
|
||||
|
||||
hyperpoint midface = Hypc;
|
||||
for(int i=0; i<face; i++) midface += cspin(1, 2, 2*i*M_PI/face) * v2;
|
||||
for(int i=0; i<face; i++) midface += cspin(1, 2, TAU * i/face) * v2;
|
||||
midface = normalize(midface);
|
||||
ld between_centers = 2 * hdist0(midface);
|
||||
DEBB(DF_GEOM, ("between_centers = ", between_centers));
|
||||
|
||||
if(S7 == 20) {
|
||||
spins[0] = Id;
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin(1, 2, M_PI);
|
||||
spins[2] = spins[1] * cspin(1, 2, -2 * M_PI/face) * spins[1];
|
||||
spins[3] = spins[1] * cspin(1, 2, +2 * M_PI/face) * spins[1];
|
||||
for(int a=4; a<10; a++) spins[a] = cspin(1, 2, 2*M_PI/face) * spins[a-3];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = spins[a-S7/2] * cspin(0, 1, M_PI);
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin180(1, 2);
|
||||
spins[2] = spins[1] * cspin(1, 2, -TAU/face) * spins[1];
|
||||
spins[3] = spins[1] * cspin(1, 2, +TAU/face) * spins[1];
|
||||
for(int a=4; a<10; a++) spins[a] = cspin(1, 2, TAU/face) * spins[a-3];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = spins[a-S7/2] * spin180();
|
||||
}
|
||||
|
||||
if(S7 == 12 || S7 == 8) {
|
||||
spins[0] = Id;
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin(1, 2, M_PI);
|
||||
for(int a=2; a<face+1; a++) spins[a] = cspin(1, 2, 2*M_PI*(a-1)/face) * spins[1];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = cspin(0, 1, M_PI) * spins[a-S7/2];
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin180(1, 2);
|
||||
for(int a=2; a<face+1; a++) spins[a] = cspin(1, 2, TAU*(a-1)/face) * spins[1];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = cspin180(0, 1) * spins[a-S7/2];
|
||||
if(S7 == 8) swap(spins[6], spins[7]);
|
||||
if(S7 == 12) swap(spins[8], spins[11]);
|
||||
if(S7 == 12) swap(spins[9], spins[10]);
|
||||
@@ -302,25 +302,25 @@ EX namespace reg3 {
|
||||
|
||||
if(S7 == 6) {
|
||||
spins[0] = Id;
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin(1, 2, M_PI);
|
||||
spins[2] = cspin(1, 2, M_PI/2) * spins[1];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = spins[a-S7/2] * cspin(0, 1, M_PI);
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin180(1, 2);
|
||||
spins[2] = cspin90(1, 2) * spins[1];
|
||||
for(int a=S7/2; a<S7; a++) spins[a] = spins[a-S7/2] * cspin180(0, 1);
|
||||
}
|
||||
|
||||
if(S7 == 4) {
|
||||
spins[0] = Id;
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin(1, 2, M_PI);
|
||||
for(int a=2; a<face+1; a++) spins[a] = cspin(1, 2, 2*M_PI*(a-1)/face) * spins[1];
|
||||
spins[1] = cspin(0, 1, angle_between_faces) * cspin180(1, 2);
|
||||
for(int a=2; a<face+1; a++) spins[a] = cspin(1, 2, TAU*(a-1)/face) * spins[1];
|
||||
}
|
||||
|
||||
cellshape.clear();
|
||||
cellshape.resize(S7);
|
||||
for(int a=0; a<S7; a++) {
|
||||
for(int b=0; b<face; b++)
|
||||
cellshape[a].push_back(spins[a] * cspin(1, 2, 2*M_PI*b/face) * v2);
|
||||
cellshape[a].push_back(spins[a] * cspin(1, 2, TAU*b/face) * v2);
|
||||
}
|
||||
|
||||
cgi.adjmoves[0] = cpush(0, between_centers) * cspin(0, 2, M_PI);
|
||||
cgi.adjmoves[0] = cpush(0, between_centers) * cspin180(0, 2);
|
||||
for(int i=1; i<S7; i++) cgi.adjmoves[i] = spins[i] * cgi.adjmoves[0];
|
||||
|
||||
for(int a=0; a<S7; a++)
|
||||
@@ -334,7 +334,7 @@ EX namespace reg3 {
|
||||
else cgi.strafedist = hdist(cgi.adjmoves[0] * C0, cgi.adjmoves[1] * C0);
|
||||
|
||||
if(stretch::applicable()) {
|
||||
transmatrix T = cspin(0, 2, 90 * degree);
|
||||
transmatrix T = cspin90(0, 2);
|
||||
transmatrix iT = inverse(T);
|
||||
for(auto& v: cgi.adjmoves) v = T * v * iT;
|
||||
for(auto& vv: cellshape) for(auto& v: vv) v = T * v;
|
||||
@@ -1294,7 +1294,7 @@ EX namespace reg3 {
|
||||
allh[a]->c.connect(b, allh[a1], flip(b), false);
|
||||
transmatrix T = cgi.adjmoves[b];
|
||||
hyperpoint p = tC0(T);
|
||||
tmatrices[a][b] = rspintox(p) * xpush(hdist0(p)) * cspin(2, 1, 108 * degree) * spintox(p);
|
||||
tmatrices[a][b] = rspintox(p) * xpush(hdist0(p)) * cspin(2, 1, 108._deg) * spintox(p);
|
||||
}
|
||||
}
|
||||
make_subconnections();
|
||||
@@ -1310,7 +1310,7 @@ EX namespace reg3 {
|
||||
hrmap_quotient3 *gen_quotient_map(bool minimized, fieldpattern::fpattern &fp) {
|
||||
#if CAP_FIELD
|
||||
if(geometry == gSpace535 && minimized) {
|
||||
return new seifert_weber::hrmap_singlecell(108*degree);
|
||||
return new seifert_weber::hrmap_singlecell(108._deg);
|
||||
}
|
||||
else if(geometry == gSpace535)
|
||||
return new seifert_weber::hrmap_seifert_cover;
|
||||
@@ -2527,8 +2527,8 @@ EX const vector<int>& rule_get_childpos() {
|
||||
|
||||
EX hrmap* new_map() {
|
||||
if(geometry == gSeifertCover) return new seifert_weber::hrmap_seifert_cover;
|
||||
if(geometry == gSeifertWeber) return new seifert_weber::hrmap_singlecell(108*degree);
|
||||
if(geometry == gHomologySphere) return new seifert_weber::hrmap_singlecell(36*degree);
|
||||
if(geometry == gSeifertWeber) return new seifert_weber::hrmap_singlecell(108._deg);
|
||||
if(geometry == gHomologySphere) return new seifert_weber::hrmap_singlecell(36._deg);
|
||||
if(quotient && !sphere) return new hrmap_field3(&currfp);
|
||||
if(variation_rule_available()) return new hrmap_h3_subrule;
|
||||
if(pure_rule_available()) return new hrmap_h3_rule;
|
||||
@@ -2633,7 +2633,7 @@ EX bool pseudohept(cell *c) {
|
||||
auto m = currentmap;
|
||||
hyperpoint h = tC0(m->relative_matrix(c->master, m->getOrigin(), C0));
|
||||
if(S7 == 12) {
|
||||
hyperpoint h1 = cspin(0, 1, atan2(16, 69) + M_PI/4) * h;
|
||||
hyperpoint h1 = cspin(0, 1, atan2(16, 69) + 45._deg) * h;
|
||||
for(int i=0; i<4; i++) if(abs(abs(h1[i]) - .5) > .01) return false;
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user