1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-26 07:02:49 +00:00

replaced euclid3:: with euc::

This commit is contained in:
Zeno Rogue 2019-12-08 11:01:28 +01:00
parent ddb5d07ff6
commit e8a39e6663
11 changed files with 38 additions and 42 deletions

View File

@ -49,7 +49,7 @@ EX int celldistAltRelative(cell *c) {
if(cryst) return crystal::dist_relative(c); if(cryst) return crystal::dist_relative(c);
#endif #endif
#if MAXMDIM >= 4 #if MAXMDIM >= 4
if(euclid && WDIM == 3) return euclid3::dist_relative(c); if(euclid && WDIM == 3) return euc::dist_relative(c);
#endif #endif
if(euclid && quotient) return celldistAlt(c) - roundTableRadius(c); if(euclid && quotient) return celldistAlt(c) - roundTableRadius(c);
if(sphere || quotient) { if(sphere || quotient) {

View File

@ -276,7 +276,7 @@ EX void initcells() {
#if CAP_ARCM #if CAP_ARCM
else if(archimedean) currentmap = arcm::new_map(); else if(archimedean) currentmap = arcm::new_map();
#endif #endif
else if(euclid && !penrose) currentmap = euclid3::new_map(); else if(euclid && !penrose) currentmap = euc::new_map();
#if CAP_BT #if CAP_BT
else if(penrose) currentmap = kite::new_map(); else if(penrose) currentmap = kite::new_map();
#endif #endif
@ -487,7 +487,7 @@ EX int celldistAlt(cell *c) {
return celldist(c) - 3; return celldist(c) - 3;
} }
#if MAXMDIM >= 4 #if MAXMDIM >= 4
if(euclid && WDIM == 3) return euclid3::dist_alt(c); if(euclid && WDIM == 3) return euc::dist_alt(c);
if(hyperbolic && WDIM == 3) return reg3::altdist(c->master); if(hyperbolic && WDIM == 3) return reg3::altdist(c->master);
#endif #endif
if(!c->master->alt) return 0; if(!c->master->alt) return 0;
@ -1043,7 +1043,7 @@ EX int celldistance(cell *c1, cell *c2) {
#if MAXMDIM >= 4 #if MAXMDIM >= 4
if(euclid && !penrose && !archimedean) if(euclid && !penrose && !archimedean)
return euclid3::celldistance(c1, c2); return euc::celldistance(c1, c2);
if(hyperbolic && WDIM == 3) return reg3::celldistance(c1, c2); if(hyperbolic && WDIM == 3) return reg3::celldistance(c1, c2);
#endif #endif

View File

@ -640,7 +640,7 @@ EX color_t colorize(cell *c, char whichCanvas) {
} }
#endif #endif
else if(euclid) { else if(euclid) {
auto tab = euclid3::get_ispacemap()[c->master]; auto tab = euc::get_ispacemap()[c->master];
for(int a=0; a<3; a++) co[a] = tab[a]; for(int a=0; a<3; a++) co[a] = tab[a];
if(PURE) for(int a=0; a<3; a++) co[a] *= 2; if(PURE) for(int a=0; a<3; a++) co[a] *= 2;
dim = 3; dim = 3;
@ -1497,11 +1497,11 @@ EX void may_place_compass(cell *c) {
#if CAP_CRYSTAL && MAXMDIM >= 4 #if CAP_CRYSTAL && MAXMDIM >= 4
euclid3::coord crystal_to_euclid(coord x) { euc::coord crystal_to_euclid(coord x) {
return euclid3::coord(x[0]/2, x[1]/2, x[2]/2); return euc::coord(x[0]/2, x[1]/2, x[2]/2);
} }
coord euclid3_to_crystal(euclid3::coord x) { coord euclid3_to_crystal(euc::coord x) {
coord res; coord res;
for(int i=0; i<3; i++) res[i] = x[i] * 2; for(int i=0; i<3; i++) res[i] = x[i] * 2;
for(int i=3; i<MAXDIM; i++) res[i] = 0; for(int i=3; i<MAXDIM; i++) res[i] = 0;
@ -1510,16 +1510,16 @@ coord euclid3_to_crystal(euclid3::coord x) {
void transform_crystal_to_euclid () { void transform_crystal_to_euclid () {
euclid3::clear_torus3(); euc::clear_torus3();
geometry = gCubeTiling; geometry = gCubeTiling;
auto e = euclid3::new_map(); auto e = euc::new_map();
auto m = crystal_map(); auto m = crystal_map();
auto infront = cwt.cpeek(); auto infront = cwt.cpeek();
auto& spacemap = euclid3::get_spacemap(); auto& spacemap = euc::get_spacemap();
auto& ispacemap = euclid3::get_ispacemap(); auto& ispacemap = euc::get_ispacemap();
auto& camelot_center = euclid3::get_camelot_center(); auto& camelot_center = euc::get_camelot_center();
auto& shifttable = euclid3::get_current_shifttable(); auto& shifttable = euc::get_current_shifttable();
for(auto& p: m->hcoords) { for(auto& p: m->hcoords) {
auto co = crystal_to_euclid(p.second); auto co = crystal_to_euclid(p.second);
@ -1584,9 +1584,9 @@ void transform_euclid_to_crystal () {
auto m = new hrmap_crystal; auto m = new hrmap_crystal;
auto infront = cwt.cpeek(); auto infront = cwt.cpeek();
auto& spacemap = euclid3::get_spacemap(); auto& spacemap = euc::get_spacemap();
auto& ispacemap = euclid3::get_ispacemap(); auto& ispacemap = euc::get_ispacemap();
auto& camelot_center = euclid3::get_camelot_center(); auto& camelot_center = euc::get_camelot_center();
for(auto& p: ispacemap) { for(auto& p: ispacemap) {
auto co = euclid3_to_crystal(p.second); auto co = euclid3_to_crystal(p.second);

View File

@ -60,7 +60,7 @@ EX namespace euc {
break; break;
default: default:
printf("euclid3::get_shifttable() called in geometry that is not euclid3"); printf("euc::get_shifttable() called in geometry that is not euclid3");
exit(1); exit(1);
} }
@ -119,7 +119,7 @@ EX namespace euc {
EX torus_config eu_input, eu_edit; EX torus_config eu_input, eu_edit;
EX torus_config_full eu; EX torus_config_full eu;
struct hrmap_euclid3 : hrmap_standard { struct hrmap_euclidean : hrmap_standard {
vector<coord> shifttable; vector<coord> shifttable;
vector<transmatrix> tmatrix; vector<transmatrix> tmatrix;
map<coord, heptagon*> spacemap; map<coord, heptagon*> spacemap;
@ -140,7 +140,7 @@ EX namespace euc {
return hrmap::allcells(); return hrmap::allcells();
} }
hrmap_euclid3() { hrmap_euclidean() {
shifttable = get_shifttable(); shifttable = get_shifttable();
tmatrix.resize(S7); tmatrix.resize(S7);
for(int i=0; i<S7; i++) for(int i=0; i<S7; i++)
@ -161,7 +161,7 @@ EX namespace euc {
if(!IRREGULAR) if(!IRREGULAR)
h->c7 = newCell(S7, h); h->c7 = newCell(S7, h);
else else
irr::link_to_base(h, ((hrmap_euclid3*)irr::base)->get_at(at)); irr::link_to_base(h, ((hrmap_euclidean*)irr::base)->get_at(at));
h->distance = 0; h->distance = 0;
h->cdata = NULL; h->cdata = NULL;
h->alt = NULL; h->alt = NULL;
@ -285,11 +285,11 @@ EX namespace euc {
} }
}; };
hrmap_euclid3* cubemap() { hrmap_euclidean* cubemap() {
return ((hrmap_euclid3*) currentmap); return ((hrmap_euclidean*) currentmap);
} }
hrmap_euclid3* eucmap() { return cubemap(); } hrmap_euclidean* eucmap() { return cubemap(); }
EX vector<coord>& get_current_shifttable() { return cubemap()->shifttable; } EX vector<coord>& get_current_shifttable() { return cubemap()->shifttable; }
EX map<coord, heptagon*>& get_spacemap() { return cubemap()->spacemap; } EX map<coord, heptagon*>& get_spacemap() { return cubemap()->spacemap; }
@ -297,7 +297,7 @@ EX namespace euc {
EX cell *& get_camelot_center() { return cubemap()->camelot_center; } EX cell *& get_camelot_center() { return cubemap()->camelot_center; }
EX hrmap* new_map() { EX hrmap* new_map() {
return new hrmap_euclid3; return new hrmap_euclidean;
} }
EX transmatrix move_matrix(heptagon *h, int i) { EX transmatrix move_matrix(heptagon *h, int i) {
@ -394,11 +394,11 @@ EX namespace euc {
cell *start = m->gamestart(); cell *start = m->gamestart();
if(!cc) { if(!cc) {
cc = start; cc = start;
while(euclid3::celldistance(cc, start) < r + 5) while(euc::celldistance(cc, start) < r + 5)
cc = cc->cmove(hrand(cc->type)); cc = cc->cmove(hrand(cc->type));
} }
return euclid3::celldistance(cc, c) - r; return euc::celldistance(cc, c) - r;
} }
/* quotient spaces */ /* quotient spaces */
@ -1127,10 +1127,6 @@ EX int cyldist(gp::loc a, gp::loc b) {
EX } EX }
#if HDR
namespace euclid3 { using namespace euc; }
#endif
EX gp::loc euc2_coordinates(cell *c) { return euc::full_coords2(c); } EX gp::loc euc2_coordinates(cell *c) { return euc::full_coords2(c); }
} }

View File

@ -470,8 +470,8 @@ EX void select_quotient_screen() {
EX void select_quotient() { EX void select_quotient() {
if(euclid && !penrose && !archimedean) { if(euclid && !penrose && !archimedean) {
euclid3::prepare_torus3(); euc::prepare_torus3();
pushScreen(euclid3::show_torus3); pushScreen(euc::show_torus3);
} }
else if(nil) { else if(nil) {
nilv::prepare_niltorus3(), nilv::prepare_niltorus3(),
@ -585,7 +585,7 @@ EX void showEuclideanMenu() {
} }
if(euclid && bounded) { if(euclid && bounded) {
worldsize = euclid3::eu.det; worldsize = euc::eu.det;
if(BITRUNCATED) worldsize *= (a4 ? 2 : 3); if(BITRUNCATED) worldsize *= (a4 ? 2 : 3);
if(GOLDBERG) worldsize *= cgi.gpdata->area; if(GOLDBERG) worldsize *= cgi.gpdata->area;
if(IRREGULAR) worldsize *= isize(irr::cells) / isize(irr::cells_of_heptagon); if(IRREGULAR) worldsize *= isize(irr::cells) / isize(irr::cells_of_heptagon);

View File

@ -822,7 +822,7 @@ EX void describeMouseover() {
} }
if(euclid && cheater && WDIM == 3) { if(euclid && cheater && WDIM == 3) {
auto co = euclid3::get_ispacemap()[c->master]; auto co = euc::get_ispacemap()[c->master];
out += " (" + its(co[0]); out += " (" + its(co[0]);
for(int i=1; i<WDIM; i++) out += "," + its(co[i]); for(int i=1; i<WDIM; i++) out += "," + its(co[i]);
out += ")"; out += ")";

View File

@ -505,7 +505,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
c->wall = (c->master->zebraval & 1) ? waCavewall : waCavefloor; c->wall = (c->master->zebraval & 1) ? waCavewall : waCavefloor;
#if MAXMDIM >= 4 #if MAXMDIM >= 4
else if(euclid && WDIM == 3) else if(euclid && WDIM == 3)
c->wall = euclid3::get_emerald(c) ? waCavewall : waCavefloor; c->wall = euc::get_emerald(c) ? waCavewall : waCavefloor;
#endif #endif
else if(euclid) { else if(euclid) {
auto co = euc2_coordinates(c); auto co = euc2_coordinates(c);
@ -2654,7 +2654,7 @@ EX void setdist(cell *c, int d, cell *from) {
else if(cryst) crystal::set_land(c); else if(cryst) crystal::set_land(c);
#endif #endif
#if MAXMDIM == 4 #if MAXMDIM == 4
else if(euclid && WDIM == 3) euclid3::set_land(c); else if(euclid && WDIM == 3) euc::set_land(c);
#endif #endif
else if(hybri) setLandHybrid(c); else if(hybri) setLandHybrid(c);
else if(sphere || (euclid && bounded)) setLandSphere(c); else if(sphere || (euclid && bounded)) setLandSphere(c);

View File

@ -268,7 +268,7 @@ EX namespace models {
for(int x=-200; x<=200; x++) { for(int x=-200; x<=200; x++) {
if(y == 0 && x <= 0) continue; if(y == 0 && x <= 0) continue;
auto zero = euc::canonicalize(euc::to_coord(gp::loc{x, y})); auto zero = euc::canonicalize(euc::to_coord(gp::loc{x, y}));
if(zero == euclid3::euzero) if(zero == euc::euzero)
torus_zeros.emplace_back(x, y); torus_zeros.emplace_back(x, y);
} }
sort(torus_zeros.begin(), torus_zeros.end(), [] (const gp::loc p1, const gp::loc p2) { sort(torus_zeros.begin(), torus_zeros.end(), [] (const gp::loc p1, const gp::loc p2) {

View File

@ -1393,7 +1393,7 @@ EX bool pseudohept(cell *c) {
#if MAXMDIM == 4 #if MAXMDIM == 4
if(WDIM == 3) { if(WDIM == 3) {
if(geometry == gField435) return false; if(geometry == gField435) return false;
else if(euclid) return euclid3::pseudohept(c); else if(euclid) return euc::pseudohept(c);
else return reg3::pseudohept(c); else return reg3::pseudohept(c);
} }
#endif #endif

View File

@ -966,7 +966,7 @@ void geometry_information::create_wall3d() {
} }
if(GDIM == 3 && euclid && S7 == 12) { if(GDIM == 3 && euclid && S7 == 12) {
auto v = euclid3::get_shifttable(); auto v = euc::get_shifttable();
for(int w=0; w<12; w++) { for(int w=0; w<12; w++) {
auto co = v[w]; auto co = v[w];
vector<int> valid; vector<int> valid;
@ -979,7 +979,7 @@ void geometry_information::create_wall3d() {
} }
if(GDIM == 3 && euclid && S7 == 14) { if(GDIM == 3 && euclid && S7 == 14) {
auto v = euclid3::get_shifttable(); auto v = euc::get_shifttable();
for(int w=0; w<14; w++) { for(int w=0; w<14; w++) {
bshape(shWall3D[w], PPR::WALL); bshape(shWall3D[w], PPR::WALL);
if(w%7 < 3) { if(w%7 < 3) {

View File

@ -1081,7 +1081,7 @@ void race_projection() {
}; };
if(!alternate) { if(!alternate) {
add_thurston_race(XLAT("Euclidean"), [] { stop_game(); euclid3::clear_torus3(); set_geometry(gBitrunc3); }); add_thurston_race(XLAT("Euclidean"), [] { stop_game(); euc::clear_torus3(); set_geometry(gBitrunc3); });
add_thurston_race(XLAT("hyperbolic"), [] { set_geometry(gBinary3); vid.texture_step = 4; }); add_thurston_race(XLAT("hyperbolic"), [] { set_geometry(gBinary3); vid.texture_step = 4; });
add_thurston_race(XLAT("spherical"), [] { set_geometry(gCell120); }); add_thurston_race(XLAT("spherical"), [] { set_geometry(gCell120); });
add_thurston_race(XLAT("Solv geometry"), [] { solnihv::solrange_xy = 10; solnihv::solrange_z = 3; set_geometry(gSol); }); add_thurston_race(XLAT("Solv geometry"), [] { solnihv::solrange_xy = 10; solnihv::solrange_z = 3; set_geometry(gSol); });