mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-27 21:23:19 +00:00
refactored master_relative as virtual function
This commit is contained in:
parent
9a319e2d2a
commit
b6bf0911f3
3
cell.cpp
3
cell.cpp
@ -66,7 +66,7 @@ struct hrmap {
|
|||||||
virtual int shvid(cell *c) { return 0; }
|
virtual int shvid(cell *c) { return 0; }
|
||||||
virtual int full_shvid(cell *c) { return shvid(c); }
|
virtual int full_shvid(cell *c) { return shvid(c); }
|
||||||
virtual hyperpoint get_corner(cell *c, int cid, ld cf=3) { return C0; }
|
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);
|
virtual int wall_offset(cell *c);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -87,6 +87,7 @@ struct hrmap_standard : hrmap {
|
|||||||
void find_cell_connection(cell *c, int d) override;
|
void find_cell_connection(cell *c, int d) override;
|
||||||
virtual int shvid(cell *c) override;
|
virtual int shvid(cell *c) override;
|
||||||
virtual hyperpoint get_corner(cell *c, int cid, ld cf) 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*);
|
void clearfrom(heptagon*);
|
||||||
|
@ -52,7 +52,7 @@ EX transmatrix relative_matrix_recursive(heptagon *h2, heptagon *h1) {
|
|||||||
return gm * where;
|
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(0) ;
|
||||||
#if CAP_IRR
|
#if CAP_IRR
|
||||||
else if(IRREGULAR) {
|
else if(IRREGULAR) {
|
||||||
@ -109,18 +109,21 @@ transmatrix hrmap_standard::adj(heptagon *h, int d) {
|
|||||||
return T;
|
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;
|
heptagon *h1 = c1->master;
|
||||||
transmatrix gm = master_relative(c1, true);
|
transmatrix gm = currentmap->master_relative(c1, true);
|
||||||
heptagon *h2 = c2->master;
|
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;
|
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 hrmap_standard::relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) {
|
||||||
|
|
||||||
transmatrix gm = Id, where = Id;
|
transmatrix gm = Id, where = Id;
|
||||||
|
6
reg3.cpp
6
reg3.cpp
@ -658,6 +658,12 @@ EX namespace reg3 {
|
|||||||
return cgi.subshapes[id].vertices_only_local;
|
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();
|
void make_subconnections();
|
||||||
|
|
||||||
int wall_offset(cell *c) override;
|
int wall_offset(cell *c) override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user