approx_distance in Sol

This commit is contained in:
Zeno Rogue 2019-08-03 11:35:15 +02:00
parent 5d7ea94246
commit 875af54063
2 changed files with 11 additions and 1 deletions

View File

@ -880,6 +880,7 @@ int heptdistance(heptagon *h1, heptagon *h2) {
#if CAP_CRYSTAL
if(geometry == gCrystal) return crystal::space_distance(h1->c7, h2->c7);
#endif
if(sol) return solv::approx_distance(h1, h2);
while(true) {
if(h1 == h2) return d;
for(int i=0; i<S7; i++) if(h1->move(i) == h2) return d + 1;

11
sol.cpp
View File

@ -393,7 +393,16 @@ namespace solv {
return rspintox(inverse(back_Position) * back_goal);
}
int approx_distance(heptagon *h1, heptagon *h2) {
auto m = (hrmap_sol*) currentmap;
dynamicval<eGeometry> g(geometry, gBinary4);
dynamicval<hrmap*> cm(currentmap, m->binary_map);
int d1 = binary::celldistance3_approx(m->coords[h1].first, m->coords[h2].first);
int d2 = binary::celldistance3_approx(m->coords[h1].second, m->coords[h2].second);
return d1 + d2 - abs(h1->distance - h2->distance);
}
string solshader =
"uniform mediump sampler3D tInvExpTable;"
"uniform mediump float PRECX, PRECY, PRECZ;"