1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-22 21:23:18 +00:00

fixed generate_brm in 3D

This commit is contained in:
Zeno Rogue 2021-07-18 11:15:31 +02:00
parent 6cf00a1c3c
commit 0fc8dfde15

View File

@ -757,13 +757,26 @@ EX void generate_brm(cell *c1) {
q.pop();
ld mindist = HUGE_VAL, maxdist = 0;
for(int i=0; i<c1->type; i++)
for(int j=0; j<c2->type; j++) {
ld d = hdist(get_corner_position(c1, i), T * get_corner_position(c2, j));
if(d < mindist) mindist = d;
if(d > maxdist) maxdist = d;
}
if(WDIM == 2) {
for(int i=0; i<c1->type; i++)
for(int j=0; j<c2->type; j++) {
ld d = hdist(get_corner_position(c1, i), T * get_corner_position(c2, j));
if(d < mindist) mindist = d;
if(d > maxdist) maxdist = d;
}
}
else {
auto& ss1 = currentmap->get_cellshape(c1);
auto& ss2 = currentmap->get_cellshape(c2);
for(auto v: ss1.vertices_only)
for(auto w: ss2.vertices_only) {
ld d = hdist(v, T*w);
if(d < mindist) mindist = d;
if(d > maxdist) maxdist = d;
}
}
auto& cu = cutoff[c2];
if(cu == 0 || cu > maxdist)
cu = maxdist;