mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
removed referring to specific map subtypes
This commit is contained in:
parent
fedb170b55
commit
339f6820fe
@ -428,7 +428,7 @@ map<heptagon*, vector<pair<heptagon*, transmatrix> > > altmap;
|
|||||||
|
|
||||||
EX map<heptagon*, pair<heptagon*, transmatrix>> archimedean_gmatrix;
|
EX map<heptagon*, pair<heptagon*, transmatrix>> archimedean_gmatrix;
|
||||||
|
|
||||||
hrmap *current_altmap;
|
EX hrmap *current_altmap;
|
||||||
|
|
||||||
heptagon *build_child(heptspin p, pair<int, int> adj);
|
heptagon *build_child(heptspin p, pair<int, int> adj);
|
||||||
|
|
||||||
@ -1336,6 +1336,8 @@ EX int valence() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
EX map<int, cdata>& get_cdata() { return ((arcm::hrmap_archimedean*) (currentmap))->eucdata; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
46
cell.cpp
46
cell.cpp
@ -226,36 +226,6 @@ EX void eumerge(cell* c1, int s1, cell *c2, int s2, bool mirror) {
|
|||||||
|
|
||||||
// map<pair<eucoord, eucoord>, cell*> euclidean;
|
// map<pair<eucoord, eucoord>, cell*> euclidean;
|
||||||
|
|
||||||
EX euc_pointer euclideanAt(int vec) {
|
|
||||||
if(fulltorus) { printf("euclideanAt called\n"); exit(1); }
|
|
||||||
hrmap_euclidean* euc = dynamic_cast<hrmap_euclidean*> (currentmap);
|
|
||||||
return euc->at(vec);
|
|
||||||
}
|
|
||||||
|
|
||||||
EX euc_pointer euclideanAtCreate(int vec) {
|
|
||||||
euc_pointer ep = euclideanAt(vec);
|
|
||||||
cell*& c = *ep.first;
|
|
||||||
if(!c) {
|
|
||||||
if(euwrap) {
|
|
||||||
int x, y;
|
|
||||||
tie(x, y) = vec_to_pair(vec);
|
|
||||||
torusconfig::be_canonical(x, y);
|
|
||||||
vec = pair_to_vec(x, y);
|
|
||||||
}
|
|
||||||
c = newCell(8, encodeId(vec));
|
|
||||||
// euclideanAt(vec) = c;
|
|
||||||
build_euclidean_moves(c, vec, [c,vec] (int delta, int d, int d2) {
|
|
||||||
euc_pointer ep2 = euclideanAt(vec + delta);
|
|
||||||
cell* c2 = *ep2.first;
|
|
||||||
if(!c2) return;
|
|
||||||
// if(ep.second) d = c->c.fix(torusconfig::mobius_dir(c) - d);
|
|
||||||
if(ep2.second) d2 = c2->c.fix(torusconfig::mobius_dir(c2) - d2);
|
|
||||||
eumerge(c, d, c2, d2, ep2.second);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return ep;
|
|
||||||
}
|
|
||||||
|
|
||||||
hookset<hrmap*()> *hooks_newmap;
|
hookset<hrmap*()> *hooks_newmap;
|
||||||
|
|
||||||
/** create a map in the current geometry */
|
/** create a map in the current geometry */
|
||||||
@ -277,13 +247,13 @@ EX void initcells() {
|
|||||||
#if CAP_BT
|
#if CAP_BT
|
||||||
else if(penrose) currentmap = kite::new_map();
|
else if(penrose) currentmap = kite::new_map();
|
||||||
#endif
|
#endif
|
||||||
else if(fulltorus) currentmap = new hrmap_torus;
|
else if(fulltorus) currentmap = new_torus_map();
|
||||||
else if(euclid) currentmap = new hrmap_euclidean;
|
else if(euclid) currentmap = new_euclidean_map();
|
||||||
#if MAXMDIM >= 4
|
#if MAXMDIM >= 4
|
||||||
else if(WDIM == 3 && !binarytiling) currentmap = reg3::new_map();
|
else if(WDIM == 3 && !binarytiling) currentmap = reg3::new_map();
|
||||||
#endif
|
#endif
|
||||||
else if(sphere) currentmap = new hrmap_spherical;
|
else if(sphere) currentmap = new_spherical_map();
|
||||||
else if(quotient) currentmap = new quotientspace::hrmap_quotient;
|
else if(quotient) currentmap = quotientspace::new_map();
|
||||||
#if CAP_BT
|
#if CAP_BT
|
||||||
else if(binarytiling) currentmap = binary::new_map();
|
else if(binarytiling) currentmap = binary::new_map();
|
||||||
#endif
|
#endif
|
||||||
@ -462,7 +432,7 @@ EX int celldist(cell *c) {
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
if(fulltorus && WDIM == 2)
|
if(fulltorus && WDIM == 2)
|
||||||
return torusmap()->dists[decodeId(c->master)];
|
return get_torus_dist(decodeId(c->master));
|
||||||
if(nil) return DISTANCE_UNKNOWN;
|
if(nil) return DISTANCE_UNKNOWN;
|
||||||
if(euwrap)
|
if(euwrap)
|
||||||
return torusconfig::cyldist(decodeId(c->master), 0);
|
return torusconfig::cyldist(decodeId(c->master), 0);
|
||||||
@ -824,9 +794,7 @@ cdata *getEuclidCdata(int h) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
auto& data =
|
auto& data = archimedean ? arcm::get_cdata() : get_cdata();
|
||||||
archimedean ? ((arcm::hrmap_archimedean*) (currentmap))->eucdata :
|
|
||||||
((hrmap_euclidean*) (currentmap))->eucdata;
|
|
||||||
|
|
||||||
// hrmap_euclidean* euc = dynamic_cast<hrmap_euclidean*> (currentmap);
|
// hrmap_euclidean* euc = dynamic_cast<hrmap_euclidean*> (currentmap);
|
||||||
if(data.count(h)) return &(data[h]);
|
if(data.count(h)) return &(data[h]);
|
||||||
@ -1014,7 +982,7 @@ EX int celldistance(cell *c1, cell *c2) {
|
|||||||
if(!euwrap)
|
if(!euwrap)
|
||||||
return eudist(decodeId(c1->master) - decodeId(c2->master)); // fix cylinder
|
return eudist(decodeId(c1->master) - decodeId(c2->master)); // fix cylinder
|
||||||
else if(euwrap && torusconfig::torus_mode == 0)
|
else if(euwrap && torusconfig::torus_mode == 0)
|
||||||
return torusmap()->dists[torusconfig::vec_to_id(decodeId(c1->master)-decodeId(c2->master))];
|
return get_torus_dist(torusconfig::vec_to_id(decodeId(c1->master)-decodeId(c2->master)));
|
||||||
else if(euwrap && !fulltorus)
|
else if(euwrap && !fulltorus)
|
||||||
return torusconfig::cyldist(decodeId(c1->master), decodeId(c2->master));
|
return torusconfig::cyldist(decodeId(c1->master), decodeId(c2->master));
|
||||||
}
|
}
|
||||||
|
39
crystal.cpp
39
crystal.cpp
@ -1327,14 +1327,19 @@ coord euclid3_to_crystal(euclid3::coord x) {
|
|||||||
void transform_crystal_to_euclid () {
|
void transform_crystal_to_euclid () {
|
||||||
euclid3::clear_torus3();
|
euclid3::clear_torus3();
|
||||||
geometry = gCubeTiling;
|
geometry = gCubeTiling;
|
||||||
auto e = new euclid3::hrmap_euclid3;
|
auto e = euclid3::new_map();
|
||||||
auto m = crystal_map();
|
auto m = crystal_map();
|
||||||
auto infront = cwt.cpeek();
|
auto infront = cwt.cpeek();
|
||||||
|
|
||||||
|
auto& spacemap = euclid3::get_spacemap();
|
||||||
|
auto& ispacemap = euclid3::get_ispacemap();
|
||||||
|
auto& camelot_center = euclid3::get_camelot_center();
|
||||||
|
auto& shifttable = euclid3::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);
|
||||||
e->spacemap[co] = p.first;
|
spacemap[co] = p.first;
|
||||||
e->ispacemap[p.first] = co;
|
ispacemap[p.first] = co;
|
||||||
|
|
||||||
cell* c = p.first->c7;
|
cell* c = p.first->c7;
|
||||||
|
|
||||||
@ -1342,7 +1347,7 @@ void transform_crystal_to_euclid () {
|
|||||||
if(c->mondir < S7 && c->move(c->mondir)) {
|
if(c->mondir < S7 && c->move(c->mondir)) {
|
||||||
auto co1 = crystal_to_euclid(m->hcoords[c->move(c->mondir)->master]) - co;
|
auto co1 = crystal_to_euclid(m->hcoords[c->move(c->mondir)->master]) - co;
|
||||||
for(int i=0; i<6; i++)
|
for(int i=0; i<6; i++)
|
||||||
if(co1 == e->shifttable[i])
|
if(co1 == shifttable[i])
|
||||||
c->mondir = i;
|
c->mondir = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1350,7 +1355,7 @@ void transform_crystal_to_euclid () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(m->camelot_center)
|
if(m->camelot_center)
|
||||||
e->camelot_center = e->spacemap[crystal_to_euclid(m->hcoords[m->camelot_center->master])]->c7;
|
camelot_center = spacemap[crystal_to_euclid(m->hcoords[m->camelot_center->master])]->c7;
|
||||||
|
|
||||||
// clean hcoords and heptagon_at so that the map is not deleted when we delete m
|
// clean hcoords and heptagon_at so that the map is not deleted when we delete m
|
||||||
m->hcoords.clear();
|
m->hcoords.clear();
|
||||||
@ -1364,12 +1369,12 @@ void transform_crystal_to_euclid () {
|
|||||||
currentmap = e;
|
currentmap = e;
|
||||||
|
|
||||||
// connect the cubes
|
// connect the cubes
|
||||||
for(auto& p: e->spacemap) {
|
for(auto& p: spacemap) {
|
||||||
auto& co = p.first;
|
auto& co = p.first;
|
||||||
auto& h = p.second;
|
auto& h = p.second;
|
||||||
for(int i=0; i<S7; i++)
|
for(int i=0; i<S7; i++)
|
||||||
if(e->spacemap.count(co + e->shifttable[i]))
|
if(spacemap.count(co + shifttable[i]))
|
||||||
h->move(i) = e->spacemap[co + e->shifttable[i]],
|
h->move(i) = spacemap[co + shifttable[i]],
|
||||||
h->c.setspin(i, (i + 3) % 6, false),
|
h->c.setspin(i, (i + 3) % 6, false),
|
||||||
h->c7->move(i) = h->move(i)->c7,
|
h->c7->move(i) = h->move(i)->c7,
|
||||||
h->c7->c.setspin(i, (i + 3) % 6, false);
|
h->c7->c.setspin(i, (i + 3) % 6, false);
|
||||||
@ -1390,17 +1395,21 @@ void transform_euclid_to_crystal () {
|
|||||||
ginf[gCrystal].tiling_name = "{6,4}";
|
ginf[gCrystal].tiling_name = "{6,4}";
|
||||||
ginf[gCrystal].distlimit = distlimit_table[6];
|
ginf[gCrystal].distlimit = distlimit_table[6];
|
||||||
|
|
||||||
auto e = euclid3::cubemap();
|
auto e = currentmap;
|
||||||
auto m = new hrmap_crystal;
|
auto m = new hrmap_crystal;
|
||||||
auto infront = cwt.cpeek();
|
auto infront = cwt.cpeek();
|
||||||
|
|
||||||
for(auto& p: e->ispacemap) {
|
auto& spacemap = euclid3::get_spacemap();
|
||||||
|
auto& ispacemap = euclid3::get_ispacemap();
|
||||||
|
auto& camelot_center = euclid3::get_camelot_center();
|
||||||
|
|
||||||
|
for(auto& p: ispacemap) {
|
||||||
auto co = euclid3_to_crystal(p.second);
|
auto co = euclid3_to_crystal(p.second);
|
||||||
m->heptagon_at[co] = p.first;
|
m->heptagon_at[co] = p.first;
|
||||||
m->hcoords[p.first] = co;
|
m->hcoords[p.first] = co;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto& p: e->ispacemap) {
|
for(auto& p: ispacemap) {
|
||||||
cell *c = p.first->c7;
|
cell *c = p.first->c7;
|
||||||
if(c->mondir < S7 && c->move(c->mondir)) {
|
if(c->mondir < S7 && c->move(c->mondir)) {
|
||||||
auto co = euclid3_to_crystal(p.second);
|
auto co = euclid3_to_crystal(p.second);
|
||||||
@ -1414,11 +1423,11 @@ void transform_euclid_to_crystal () {
|
|||||||
for(int i=0; i<S7; i++) c->move(i) = NULL;
|
for(int i=0; i<S7; i++) c->move(i) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(e->camelot_center)
|
if(camelot_center)
|
||||||
m->camelot_center = m->heptagon_at[euclid3_to_crystal(e->ispacemap[e->camelot_center->master])]->c7;
|
m->camelot_center = m->heptagon_at[euclid3_to_crystal(ispacemap[camelot_center->master])]->c7;
|
||||||
|
|
||||||
e->spacemap.clear();
|
spacemap.clear();
|
||||||
e->ispacemap.clear();
|
ispacemap.clear();
|
||||||
delete e;
|
delete e;
|
||||||
|
|
||||||
for(int i=0; i<isize(allmaps); i++)
|
for(int i=0; i<isize(allmaps); i++)
|
||||||
|
81
euclid.cpp
81
euclid.cpp
@ -39,8 +39,11 @@ EX namespace torusconfig {
|
|||||||
// values as the default -- otherwise the three-color
|
// values as the default -- otherwise the three-color
|
||||||
// pattern breaks. Also, they should have no common
|
// pattern breaks. Also, they should have no common
|
||||||
// prime divisor.
|
// prime divisor.
|
||||||
int def_qty = 127*3, dx = 1, def_dy = -11*2;
|
EX int def_qty = 127*3;
|
||||||
int qty = def_qty, dy = def_dy;
|
EX int dx = 1;
|
||||||
|
EX int def_dy = -11*2;
|
||||||
|
EX int qty = def_qty;
|
||||||
|
EX int dy = def_dy;
|
||||||
|
|
||||||
EX int sdx = 12;
|
EX int sdx = 12;
|
||||||
EX int sdy = 12;
|
EX int sdy = 12;
|
||||||
@ -156,7 +159,7 @@ EX namespace torusconfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int vec_to_id(int vec) {
|
EX int vec_to_id(int vec) {
|
||||||
return vec_to_id_mirror(vec).first;
|
return vec_to_id_mirror(vec).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +211,7 @@ EX namespace torusconfig {
|
|||||||
|
|
||||||
gp::loc sdxy() { return gp::loc(sdx, sdy); }
|
gp::loc sdxy() { return gp::loc(sdx, sdy); }
|
||||||
|
|
||||||
int mobius_dir_basic() {
|
EX int mobius_dir_basic() {
|
||||||
int dscalars[6];
|
int dscalars[6];
|
||||||
for(int a=0; a<SG6; a++)
|
for(int a=0; a<SG6; a++)
|
||||||
dscalars[a] = dscalar(gp::eudir(a), sdxy());
|
dscalars[a] = dscalar(gp::eudir(a), sdxy());
|
||||||
@ -253,12 +256,12 @@ EX namespace torusconfig {
|
|||||||
// println(hlog, make_pair(ox,oy), " [", d, "] ", make_pair(x,y), " p1 = ", p1, " p2 = ", p2, " det = ", det, " smul = ", smul, " tmul = ", tmul);
|
// println(hlog, make_pair(ox,oy), " [", d, "] ", make_pair(x,y), " p1 = ", p1, " p2 = ", p2, " det = ", det, " smul = ", smul, " tmul = ", tmul);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mobius_dir(cell *c) {
|
EX int mobius_dir(cell *c) {
|
||||||
if(c->type == 8) return mobius_dir_basic() * 2;
|
if(c->type == 8) return mobius_dir_basic() * 2;
|
||||||
else return mobius_dir_basic();
|
else return mobius_dir_basic();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool be_canonical(int& x, int& y) {
|
EX bool be_canonical(int& x, int& y) {
|
||||||
using namespace torusconfig;
|
using namespace torusconfig;
|
||||||
|
|
||||||
int periods = gdiv(dscalar(gp::loc(x,y), sdxy()), dscalar(sdxy(), sdxy()));
|
int periods = gdiv(dscalar(gp::loc(x,y), sdxy()), dscalar(sdxy(), sdxy()));
|
||||||
@ -276,7 +279,7 @@ EX namespace torusconfig {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cyldist(int id1, int id2) {
|
EX int cyldist(int id1, int id2) {
|
||||||
|
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
tie(x1, y1) = vec_to_pair(id1);
|
tie(x1, y1) = vec_to_pair(id1);
|
||||||
@ -487,7 +490,7 @@ cellwalker vec_to_cellwalker(int vec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int cellwalker_to_vec(cellwalker cw) {
|
EX int cellwalker_to_vec(cellwalker cw) {
|
||||||
int id = decodeId(cw.at->master);
|
int id = decodeId(cw.at->master);
|
||||||
if(!fulltorus) {
|
if(!fulltorus) {
|
||||||
if(nonorientable) {
|
if(nonorientable) {
|
||||||
@ -538,15 +541,17 @@ EX heptagon* encodeId(int id) {
|
|||||||
|
|
||||||
EX namespace euclid3 {
|
EX namespace euclid3 {
|
||||||
|
|
||||||
|
#if HDR
|
||||||
typedef long long coord;
|
typedef long long coord;
|
||||||
static const long long COORDMAX = (1<<16);
|
constexpr long long COORDMAX = (1<<16);
|
||||||
|
#endif
|
||||||
typedef array<coord, 3> axes;
|
typedef array<coord, 3> axes;
|
||||||
typedef array<array<int, 3>, 3> intmatrix;
|
typedef array<array<int, 3>, 3> intmatrix;
|
||||||
|
|
||||||
|
|
||||||
static const axes main_axes = make_array<coord>(1, COORDMAX, COORDMAX * COORDMAX );
|
static const axes main_axes = make_array<coord>(1, COORDMAX, COORDMAX * COORDMAX );
|
||||||
|
|
||||||
array<int, 3> getcoord(coord x) {
|
EX array<int, 3> getcoord(coord x) {
|
||||||
array<int, 3> res;
|
array<int, 3> res;
|
||||||
for(int k=0; k<3; k++) {
|
for(int k=0; k<3; k++) {
|
||||||
int next = x % COORDMAX;
|
int next = x % COORDMAX;
|
||||||
@ -559,7 +564,7 @@ EX namespace euclid3 {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<coord> get_shifttable() {
|
EX vector<coord> get_shifttable() {
|
||||||
static const coord D0 = main_axes[0];
|
static const coord D0 = main_axes[0];
|
||||||
static const coord D1 = main_axes[1];
|
static const coord D1 = main_axes[1];
|
||||||
static const coord D2 = main_axes[2];
|
static const coord D2 = main_axes[2];
|
||||||
@ -757,6 +762,11 @@ EX namespace euclid3 {
|
|||||||
return ((hrmap_euclid3*) currentmap);
|
return ((hrmap_euclid3*) currentmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX vector<coord>& get_current_shifttable() { return cubemap()->shifttable; }
|
||||||
|
EX map<coord, heptagon*>& get_spacemap() { return cubemap()->spacemap; }
|
||||||
|
EX map<heptagon*, coord>& get_ispacemap() { return cubemap()->ispacemap; }
|
||||||
|
EX cell *& get_camelot_center() { return cubemap()->camelot_center; }
|
||||||
|
|
||||||
EX hrmap* new_map() {
|
EX hrmap* new_map() {
|
||||||
return new hrmap_euclid3;
|
return new hrmap_euclid3;
|
||||||
}
|
}
|
||||||
@ -765,7 +775,7 @@ EX namespace euclid3 {
|
|||||||
return cubemap()->get_move(c, i);
|
return cubemap()->get_move(c, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pseudohept(cell *c) {
|
EX bool pseudohept(cell *c) {
|
||||||
coord co = cubemap()->ispacemap[c->master];
|
coord co = cubemap()->ispacemap[c->master];
|
||||||
auto v = getcoord(co);
|
auto v = getcoord(co);
|
||||||
if(S7 == 12) {
|
if(S7 == 12) {
|
||||||
@ -777,7 +787,7 @@ EX namespace euclid3 {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dist_alt(cell *c) {
|
EX int dist_alt(cell *c) {
|
||||||
if(specialland == laCamelot) return dist_relative(c) + roundTableRadius(c);
|
if(specialland == laCamelot) return dist_relative(c) + roundTableRadius(c);
|
||||||
coord co = cubemap()->ispacemap[c->master];
|
coord co = cubemap()->ispacemap[c->master];
|
||||||
auto v = getcoord(co);
|
auto v = getcoord(co);
|
||||||
@ -786,7 +796,7 @@ EX namespace euclid3 {
|
|||||||
else return v[2]/2;
|
else return v[2]/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_emerald(cell *c) {
|
EX bool get_emerald(cell *c) {
|
||||||
auto v = getcoord(cubemap()->ispacemap[c->master]);
|
auto v = getcoord(cubemap()->ispacemap[c->master]);
|
||||||
int s0 = 0, s1 = 0;
|
int s0 = 0, s1 = 0;
|
||||||
for(int i=0; i<3; i++) {
|
for(int i=0; i<3; i++) {
|
||||||
@ -807,7 +817,7 @@ EX namespace euclid3 {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int celldistance(coord co) {
|
EX int celldistance(coord co) {
|
||||||
auto v = getcoord(co);
|
auto v = getcoord(co);
|
||||||
if(S7 == 6)
|
if(S7 == 6)
|
||||||
return abs(v[0]) + abs(v[1]) + abs(v[2]);
|
return abs(v[0]) + abs(v[1]) + abs(v[2]);
|
||||||
@ -833,12 +843,12 @@ EX namespace euclid3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int celldistance(cell *c1, cell *c2) {
|
EX int celldistance(cell *c1, cell *c2) {
|
||||||
auto cm = cubemap();
|
auto cm = cubemap();
|
||||||
return celldistance(cm->ispacemap[c1->master] - cm->ispacemap[c2->master]);
|
return celldistance(cm->ispacemap[c1->master] - cm->ispacemap[c2->master]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_land(cell *c) {
|
EX void set_land(cell *c) {
|
||||||
setland(c, specialland);
|
setland(c, specialland);
|
||||||
auto m = cubemap();
|
auto m = cubemap();
|
||||||
auto co = getcoord(m->ispacemap[c->master]);
|
auto co = getcoord(m->ispacemap[c->master]);
|
||||||
@ -1243,4 +1253,41 @@ void hrmap_euclid_any::draw() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX euc_pointer euclideanAt(int vec) {
|
||||||
|
if(fulltorus) { printf("euclideanAt called\n"); exit(1); }
|
||||||
|
hrmap_euclidean* euc = dynamic_cast<hrmap_euclidean*> (currentmap);
|
||||||
|
return euc->at(vec);
|
||||||
|
}
|
||||||
|
|
||||||
|
EX euc_pointer euclideanAtCreate(int vec) {
|
||||||
|
euc_pointer ep = euclideanAt(vec);
|
||||||
|
cell*& c = *ep.first;
|
||||||
|
if(!c) {
|
||||||
|
if(euwrap) {
|
||||||
|
int x, y;
|
||||||
|
tie(x, y) = vec_to_pair(vec);
|
||||||
|
torusconfig::be_canonical(x, y);
|
||||||
|
vec = pair_to_vec(x, y);
|
||||||
|
}
|
||||||
|
c = newCell(8, encodeId(vec));
|
||||||
|
// euclideanAt(vec) = c;
|
||||||
|
build_euclidean_moves(c, vec, [c,vec] (int delta, int d, int d2) {
|
||||||
|
euc_pointer ep2 = euclideanAt(vec + delta);
|
||||||
|
cell* c2 = *ep2.first;
|
||||||
|
if(!c2) return;
|
||||||
|
// if(ep.second) d = c->c.fix(torusconfig::mobius_dir(c) - d);
|
||||||
|
if(ep2.second) d2 = c2->c.fix(torusconfig::mobius_dir(c2) - d2);
|
||||||
|
eumerge(c, d, c2, d2, ep2.second);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return ep;
|
||||||
|
}
|
||||||
|
|
||||||
|
EX hrmap* new_torus_map() { return new hrmap_torus; }
|
||||||
|
EX hrmap* new_euclidean_map() { return new hrmap_euclidean; }
|
||||||
|
|
||||||
|
EX int get_torus_dist(int id) { return torusmap()->dists[id]; }
|
||||||
|
|
||||||
|
EX map<int, cdata>& get_cdata() { return ((hrmap_euclidean*) (currentmap))->eucdata; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -394,6 +394,8 @@ struct hrmap_quotient : hrmap_standard {
|
|||||||
vector<cell*>& allcells() { return celllist; }
|
vector<cell*>& allcells() { return celllist; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EX hrmap* new_map() { return new hrmap_quotient; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace hr {
|
|||||||
|
|
||||||
// --- spherical geometry ---
|
// --- spherical geometry ---
|
||||||
|
|
||||||
int spherecells() {
|
EX int spherecells() {
|
||||||
if(S7 == 5) return (elliptic?6:12);
|
if(S7 == 5) return (elliptic?6:12);
|
||||||
if(S7 == 4) return (elliptic?3:6);
|
if(S7 == 4) return (elliptic?3:6);
|
||||||
if(S7 == 3 && S3 == 4) return (elliptic?4:8);
|
if(S7 == 3 && S3 == 4) return (elliptic?4:8);
|
||||||
@ -20,7 +20,7 @@ int spherecells() {
|
|||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<int> siblings;
|
EX vector<int> siblings;
|
||||||
|
|
||||||
struct hrmap_spherical : hrmap_standard {
|
struct hrmap_spherical : hrmap_standard {
|
||||||
heptagon *dodecahedron[12];
|
heptagon *dodecahedron[12];
|
||||||
@ -190,10 +190,12 @@ struct hrmap_spherical : hrmap_standard {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
heptagon *getDodecahedron(int i) {
|
EX heptagon *getDodecahedron(int i) {
|
||||||
hrmap_spherical *s = dynamic_cast<hrmap_spherical*> (currentmap);
|
hrmap_spherical *s = dynamic_cast<hrmap_spherical*> (currentmap);
|
||||||
if(!s) return NULL;
|
if(!s) return NULL;
|
||||||
return s->dodecahedron[i];
|
return s->dodecahedron[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX hrmap* new_spherical_map() { return new hrmap_spherical; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user