rewritten shvid using OOP
This commit is contained in:
parent
8d18946450
commit
42fc2c44a7
|
@ -801,6 +801,10 @@ struct hrmap_arbi : hrmap {
|
||||||
transmatrix adj(cell *c, int dir) override { return adj(c->master, dir); }
|
transmatrix adj(cell *c, int dir) override { return adj(c->master, dir); }
|
||||||
|
|
||||||
ld spin_angle(cell *c, int d) override { return SPIN_NOT_AVAILABLE; }
|
ld spin_angle(cell *c, int d) override { return SPIN_NOT_AVAILABLE; }
|
||||||
|
|
||||||
|
int shvid(cell *c) override {
|
||||||
|
return id_of(c->master);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EX hrmap *new_map() { return new hrmap_arbi; }
|
EX hrmap *new_map() { return new hrmap_arbi; }
|
||||||
|
|
|
@ -780,6 +780,13 @@ struct hrmap_archimedean : hrmap {
|
||||||
}
|
}
|
||||||
else hrmap::find_cell_connection(c, d);
|
else hrmap::find_cell_connection(c, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int shvid(cell *c) override {
|
||||||
|
auto& ac = arcm::current;
|
||||||
|
int id = arcm::id_of(c->master);
|
||||||
|
if(ac.regular && id>=2 && id < 2*ac.N) id &= 1;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EX hrmap *new_map() { return new hrmap_archimedean; }
|
EX hrmap *new_map() { return new hrmap_archimedean; }
|
||||||
|
|
|
@ -431,6 +431,15 @@ EX namespace bt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int shvid(cell *c) override {
|
||||||
|
if(geometry == gBinaryTiling)
|
||||||
|
return c->type-6;
|
||||||
|
else if(geometry == gBinary4 || geometry == gTernary)
|
||||||
|
return c->master->zebraval;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int updir_at(heptagon *h) {
|
int updir_at(heptagon *h) {
|
||||||
if(geometry != gBinaryTiling) return updir();
|
if(geometry != gBinaryTiling) return updir();
|
||||||
else if(type_of(h) == 6) return bd_down;
|
else if(type_of(h) == 6) return bd_down;
|
||||||
|
|
5
cell.cpp
5
cell.cpp
|
@ -61,6 +61,7 @@ struct hrmap {
|
||||||
virtual double spacedist(cell *c, int i) { return hdist0(tC0(adj(c, i))); }
|
virtual double spacedist(cell *c, int i) { return hdist0(tC0(adj(c, i))); }
|
||||||
|
|
||||||
virtual void find_cell_connection(cell *c, int d);
|
virtual void find_cell_connection(cell *c, int d);
|
||||||
|
virtual int shvid(cell *c) { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/** hrmaps which are based on regular non-Euclidean 2D tilings, possibly quotient
|
/** hrmaps which are based on regular non-Euclidean 2D tilings, possibly quotient
|
||||||
|
@ -78,6 +79,7 @@ struct hrmap_standard : hrmap {
|
||||||
ld spin_angle(cell *c, int d) override;
|
ld spin_angle(cell *c, int d) override;
|
||||||
double spacedist(cell *c, int i) override;
|
double spacedist(cell *c, int i) override;
|
||||||
void find_cell_connection(cell *c, int d) override;
|
void find_cell_connection(cell *c, int d) override;
|
||||||
|
virtual int shvid(cell *c);
|
||||||
};
|
};
|
||||||
|
|
||||||
void clearfrom(heptagon*);
|
void clearfrom(heptagon*);
|
||||||
|
@ -216,9 +218,6 @@ void hrmap_standard::find_cell_connection(cell *c, int d) {
|
||||||
}
|
}
|
||||||
hybrid::link();
|
hybrid::link();
|
||||||
}
|
}
|
||||||
else if(INVERSE) {
|
|
||||||
gp::inverse_move(c, d);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
else if(PURE) {
|
else if(PURE) {
|
||||||
hrmap::find_cell_connection(c, d);
|
hrmap::find_cell_connection(c, d);
|
||||||
|
|
|
@ -848,7 +848,7 @@ EX namespace gp {
|
||||||
cgi.extra_vertices();
|
cgi.extra_vertices();
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_plainshape_id(cell *c) {
|
EX int get_plainshape_id(cell *c) {
|
||||||
int siid, sidir;
|
int siid, sidir;
|
||||||
cell *c1 = c;
|
cell *c1 = c;
|
||||||
auto f = [&] {
|
auto f = [&] {
|
||||||
|
@ -924,36 +924,18 @@ EX void set_floor(const transmatrix& spin, hpcshape& sh) {
|
||||||
}
|
}
|
||||||
|
|
||||||
EX int shvid(cell *c) {
|
EX int shvid(cell *c) {
|
||||||
if(hybri) {
|
return currentmap->shvid(c);
|
||||||
cell *c1 = hybrid::get_where(c).first;
|
}
|
||||||
return PIU( shvid(c1) );
|
|
||||||
}
|
int hrmap_standard::shvid(cell *c) {
|
||||||
else if(GOLDBERG_INV)
|
if(GOLDBERG)
|
||||||
return gp::get_plainshape_id(c);
|
return gp::get_plainshape_id(c);
|
||||||
#if CAP_IRR
|
#if CAP_IRR
|
||||||
else if(IRREGULAR)
|
else if(IRREGULAR)
|
||||||
return irr::cellindex[c];
|
return irr::cellindex[c];
|
||||||
#endif
|
#endif
|
||||||
#if CAP_ARCM
|
|
||||||
else if(arcm::in()) {
|
|
||||||
auto& ac = arcm::current;
|
|
||||||
int id = arcm::id_of(c->master);
|
|
||||||
if(ac.regular && id>=2 && id < 2*ac.N) id &= 1;
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if(arb::in())
|
|
||||||
return arb::id_of(c->master);
|
|
||||||
else if(geosupport_football() == 2)
|
else if(geosupport_football() == 2)
|
||||||
return pseudohept(c);
|
return pseudohept(c);
|
||||||
#if CAP_BT
|
|
||||||
else if(geometry == gBinaryTiling)
|
|
||||||
return c->type-6;
|
|
||||||
else if(kite::in())
|
|
||||||
return kite::getshape(c->master);
|
|
||||||
else if(geometry == gBinary4 || geometry == gTernary)
|
|
||||||
return c->master->zebraval;
|
|
||||||
#endif
|
|
||||||
else if(inforder::mixed()) {
|
else if(inforder::mixed()) {
|
||||||
int t = c->type;
|
int t = c->type;
|
||||||
static vector<bool> computed;
|
static vector<bool> computed;
|
||||||
|
|
|
@ -1273,6 +1273,13 @@ EX namespace gp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void find_cell_connection(cell *c, int d) override {
|
||||||
|
inverse_move(c, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
int shvid(cell *c) override {
|
||||||
|
return gp::get_plainshape_id(c);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EX hrmap* new_inverse() { return new hrmap_inverse; }
|
EX hrmap* new_inverse() { return new hrmap_inverse; }
|
||||||
|
|
4
kite.cpp
4
kite.cpp
|
@ -152,6 +152,10 @@ struct hrmap_kite : hrmap {
|
||||||
kite::find_cell_connection(c, d);
|
kite::find_cell_connection(c, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int shvid(cell *c) override {
|
||||||
|
return kite::getshape(c->master);
|
||||||
|
}
|
||||||
|
|
||||||
heptagon *newtile(pshape s, int dist) {
|
heptagon *newtile(pshape s, int dist) {
|
||||||
heptagon *h = tailored_alloc<heptagon> (8);
|
heptagon *h = tailored_alloc<heptagon> (8);
|
||||||
h->s = hstate(s);
|
h->s = hstate(s);
|
||||||
|
|
|
@ -1275,6 +1275,11 @@ EX namespace hybrid {
|
||||||
void find_cell_connection(cell *c, int d) override {
|
void find_cell_connection(cell *c, int d) override {
|
||||||
hybrid::find_cell_connection(c, d);
|
hybrid::find_cell_connection(c, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int shvid(cell *c) override {
|
||||||
|
cell *c1 = hybrid::get_where(c).first;
|
||||||
|
return PIU( shvid(c1) );
|
||||||
|
}
|
||||||
|
|
||||||
virtual transmatrix spin_to(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return in_underlying([&] { return currentmap->spin_to(c, d, bonus); }); }
|
virtual transmatrix spin_to(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return in_underlying([&] { return currentmap->spin_to(c, d, bonus); }); }
|
||||||
virtual transmatrix spin_from(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return in_underlying([&] { return currentmap->spin_from(c, d, bonus); }); }
|
virtual transmatrix spin_from(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return in_underlying([&] { return currentmap->spin_from(c, d, bonus); }); }
|
||||||
|
|
Loading…
Reference in New Issue