1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 22:39:53 +00:00

reg3:: subcubes:: optimized also identifying cells

This commit is contained in:
Zeno Rogue 2021-07-08 22:03:31 +02:00
parent 889866f166
commit 45bdbdbbcc

View File

@ -638,17 +638,20 @@ EX namespace reg3 {
map<int, int> by_sides; map<int, int> by_sides;
vector<map<unsigned, vector<hyperpoint> > > which_cell_0;
which_cell_0.resize(isize(allh));
acells_by_master.resize(isize(allh)); acells_by_master.resize(isize(allh));
for(int a=0; a<isize(allh); a++) { for(int a=0; a<isize(allh); a++) {
for(int id=0; id<isize(ss); id++) { for(int id=0; id<isize(ss); id++) {
bool exists = false; bool exists = false;
auto& cc = ss[id].cellcenter;
for(auto& va: vertex_adjacencies[a]) { for(auto& va: vertex_adjacencies[a]) {
for(auto c1: acells_by_master[va.h_id]) { hyperpoint h = iso_inverse(va.T) * cc;
int id1 = local_id[c1].second; for(auto h1: which_cell_0[va.h_id][bucketer(h)])
if(hdist(ss[id].cellcenter, va.T * ss[id1].cellcenter) < 1e-6) if(hdist(h1, h) < 1e-6)
exists = true; exists = true;
} }
}
if(exists) continue; if(exists) continue;
cell *c = newCell(isize(ss[id].faces), allh[a]); cell *c = newCell(isize(ss[id].faces), allh[a]);
by_sides[isize(ss[id].faces)]++; by_sides[isize(ss[id].faces)]++;
@ -657,6 +660,7 @@ EX namespace reg3 {
local_id[c] = {isize(acells), id}; local_id[c] = {isize(acells), id};
acells.push_back(c); acells.push_back(c);
acells_by_master[a].push_back(c); acells_by_master[a].push_back(c);
which_cell_0[a][bucketer(cc)].push_back(cc);
} }
} }