mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-19 23:30:25 +00:00
reg3:: in reg hyperbolic honeycombs, celldistance now works correctly for small distances (required for trans walls)
This commit is contained in:
parent
adaed6be7c
commit
ce632ff9d5
34
reg3.cpp
34
reg3.cpp
@ -18,6 +18,16 @@ namespace binary {
|
||||
|
||||
namespace reg3 {
|
||||
|
||||
map<int, int> close_distances;
|
||||
|
||||
int bucketer(ld x) {
|
||||
return int(x * 10 + 100000.5) - 100000;
|
||||
}
|
||||
|
||||
int bucketer(hyperpoint h) {
|
||||
return bucketer(h[0]) + 1000 * bucketer(h[1]) + 1000000 * bucketer(h[2]);
|
||||
}
|
||||
|
||||
int loop, face;
|
||||
|
||||
vector<hyperpoint> cellshape;
|
||||
@ -192,6 +202,12 @@ namespace reg3 {
|
||||
|
||||
reg_gmatrix[origin] = make_pair(alt, T);
|
||||
altmap[alt].emplace_back(origin, T);
|
||||
|
||||
celllister cl(origin->c7, 4, 100000, NULL);
|
||||
for(cell *c: cl.lst) {
|
||||
hyperpoint h = tC0(relative_matrix(c->master, origin));
|
||||
close_distances[bucketer(h)] = cl.getdist(c);
|
||||
}
|
||||
}
|
||||
|
||||
ld worst_error1, worst_error2;
|
||||
@ -315,9 +331,15 @@ void draw() {
|
||||
|
||||
int celldistance(cell *c1, cell *c2) {
|
||||
if(c1 == c2) return 0;
|
||||
|
||||
auto r = regmap();
|
||||
|
||||
hyperpoint h = tC0(relative_matrix(c1->master, c2->master));
|
||||
int b = bucketer(h);
|
||||
if(close_distances.count(b)) return close_distances[b];
|
||||
|
||||
dynamicval<eGeometry> g(geometry, gBinary3);
|
||||
return 1 + binary::celldistance3(r->reg_gmatrix[c1->master].first, r->reg_gmatrix[c2->master].first);
|
||||
return 20 + binary::celldistance3(r->reg_gmatrix[c1->master].first, r->reg_gmatrix[c2->master].first);
|
||||
}
|
||||
|
||||
bool pseudohept(cell *c) {
|
||||
@ -360,16 +382,6 @@ ld adistance(cell *c) {
|
||||
return regmap()->reg_gmatrix[c->master].first->distance * log(2) - h[0];
|
||||
}
|
||||
|
||||
int bucketer(ld x) {
|
||||
return int(x * 10 + 100000.5) - 100000;
|
||||
}
|
||||
|
||||
int bucketer(hyperpoint h) {
|
||||
return bucketer(h[0]) + 1000 * bucketer(h[1]) + 1000000 * bucketer(h[2]);
|
||||
}
|
||||
|
||||
map<int, int> close_distances;
|
||||
|
||||
unordered_map<pair<cell*, cell*>, int> memo;
|
||||
|
||||
bool cdd;
|
||||
|
Loading…
Reference in New Issue
Block a user