proper hrmap_* for syntetic; fixed a bug when deleting

This commit is contained in:
Zeno Rogue 2018-08-19 18:04:56 +02:00
parent d094417cf6
commit c42940684c
2 changed files with 61 additions and 33 deletions

View File

@ -65,9 +65,7 @@ hrmap_hyperbolic::hrmap_hyperbolic() {
h.alt = NULL;
h.distance = 0;
isnonbitrunc = nonbitrunc;
if(syntetic)
synt::initialize(&h);
else if(binarytiling) {
if(binarytiling) {
#if DEBUG_BINARY_TILING
binary::xcode.clear();
binary::rxcode.clear();
@ -876,7 +874,7 @@ cell*& euclideanAtCreate(int vec) {
void initcells() {
DEBB(DF_INIT, (debugfile,"initcells\n"));
if(syntetic) currentmap = new hrmap_hyperbolic;
if(syntetic) currentmap = synt::new_map();
else if(torus) currentmap = new hrmap_torus;
else if(euclid) currentmap = new hrmap_euclidean;
else if(sphere) currentmap = new hrmap_spherical;
@ -957,7 +955,7 @@ void clearfrom(heptagon *at) {
at->cdata = NULL;
}
}
int edges = S7;
int edges = at->degree();
if(binarytiling) edges = at->c7->type;
for(int i=0; i<edges; i++) if(at->move(i)) {
if(at->move(i)->alt != &deletion_marker)

View File

@ -270,40 +270,70 @@ map<heptagon*, vector<pair<heptagon*, transmatrix> > > altmap;
map<heptagon*, pair<heptagon*, transmatrix>> syntetic_gmatrix;
void initialize(heptagon *h) {
/* initialize the root */
hrmap *current_altmap;
parent_index_of(h) = 0;
id_of(h) = 0;
h->c7 = newCell(isize(adjacent[0]), h);
struct hrmap_syntetic : hrmap {
heptagon *origin;
heptagon *getOrigin() { return origin; }
hrmap_syntetic() {
origin = new heptagon;
origin->s = hsOrigin;
origin->emeraldval = 0;
origin->zebraval = 0;
origin->fiftyval = 0;
origin->fieldval = 0;
origin->rval0 = origin->rval1 = 0;
origin->cdata = NULL;
origin->c.clear();
origin->alt = NULL;
origin->distance = 0;
parent_index_of(origin) = 0;
id_of(origin) = 0;
origin->c7 = newCell(isize(adjacent[0]), origin);
heptagon *alt = NULL;
if(hyperbolic) {
dynamicval<eGeometry> g(geometry, gNormal);
alt = new heptagon;
alt->s = hsOrigin;
alt->emeraldval = 0;
alt->zebraval = 0;
alt->c.clear();
alt->distance = 0;
alt->c7 = NULL;
alt->alt = alt;
alt->cdata = NULL;
current_altmap = newAltMap(alt);
}
heptagon *alt = NULL;
if(hyperbolic) {
dynamicval<eGeometry> g(geometry, gNormal);
alt = new heptagon;
alt->s = hsOrigin;
alt->emeraldval = 0;
alt->zebraval = 0;
alt->c.clear();
alt->distance = 0;
alt->c7 = NULL;
alt->alt = alt;
alt->cdata = NULL;
newAltMap(alt);
transmatrix T = xpush(.01241) * spin(1.4117) * xpush(0.1241) * Id;
syntetic_gmatrix[origin] = make_pair(alt, T);
altmap[alt].emplace_back(origin, T);
base_distlimit = 0;
celllister cl(origin->c7, 1000, 200, NULL);
base_distlimit = cl.dists.back();
if(sphere) base_distlimit = 15;
}
transmatrix T = xpush(.01241) * spin(1.4117) * xpush(0.1241) * Id;
syntetic_gmatrix[h] = make_pair(alt, T);
altmap[alt].emplace_back(h, T);
base_distlimit = 0;
celllister cl(h->c7, 1000, 200, NULL);
base_distlimit = cl.dists.back();
if(sphere) base_distlimit = 15;
~hrmap_syntetic() {
clearfrom(origin);
altmap.clear();
syntetic_gmatrix.clear();
if(current_altmap) {
dynamicval<eGeometry> g(geometry, gNormal);
delete current_altmap;
current_altmap = NULL;
}
}
void verify() { }
};
hrmap *new_map() { return new hrmap_syntetic; }
transmatrix adjcell_matrix(heptagon *h, int d);
heptagon *build_child(heptagon *parent, int d, int id, int pindex) {