refactored master_relative as virtual function

This commit is contained in:
Zeno Rogue 2021-07-09 10:10:13 +02:00
parent 9a319e2d2a
commit b6bf0911f3
3 changed files with 17 additions and 7 deletions

View File

@ -66,7 +66,7 @@ struct hrmap {
virtual int shvid(cell *c) { return 0; }
virtual int full_shvid(cell *c) { return shvid(c); }
virtual hyperpoint get_corner(cell *c, int cid, ld cf=3) { return C0; }
virtual transmatrix master_relative(cell *c, bool get_inverse = false) { return Id; }
virtual int wall_offset(cell *c);
};
@ -87,6 +87,7 @@ struct hrmap_standard : hrmap {
void find_cell_connection(cell *c, int d) override;
virtual int shvid(cell *c) override;
virtual hyperpoint get_corner(cell *c, int cid, ld cf) override;
virtual transmatrix master_relative(cell *c, bool get_inverse) override;
};
void clearfrom(heptagon*);

View File

@ -52,7 +52,7 @@ EX transmatrix relative_matrix_recursive(heptagon *h2, heptagon *h1) {
return gm * where;
}
EX transmatrix master_relative(cell *c, bool get_inverse IS(false)) {
transmatrix hrmap_standard::master_relative(cell *c, bool get_inverse) {
if(0) ;
#if CAP_IRR
else if(IRREGULAR) {
@ -109,18 +109,21 @@ transmatrix hrmap_standard::adj(heptagon *h, int d) {
return T;
}
transmatrix hrmap_standard::relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) {
EX transmatrix relative_matrix_via_masters(cell *c2, cell *c1, const hyperpoint& hint) {
heptagon *h1 = c1->master;
transmatrix gm = master_relative(c1, true);
transmatrix gm = currentmap->master_relative(c1, true);
heptagon *h2 = c2->master;
transmatrix where = master_relative(c2);
transmatrix where = currentmap->master_relative(c2);
transmatrix U = relative_matrix(h2, h1, hint);
transmatrix U = currentmap->relative_matrix(h2, h1, hint);
return gm * U * where;
}
transmatrix hrmap_standard::relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) {
return relative_matrix_via_masters(c2, c1, hint);
}
transmatrix hrmap_standard::relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) {
transmatrix gm = Id, where = Id;

View File

@ -657,6 +657,12 @@ EX namespace reg3 {
int id = local_id[c].second;
return cgi.subshapes[id].vertices_only_local;
}
transmatrix master_relative(cell *c, bool get_inverse) {
int id = local_id[c].second;
auto& ss = cgi.subshapes[id];
return get_inverse ? ss.from_cellcenter : ss.to_cellcenter;
}
void make_subconnections();