From 875af5406334e957d9304faf738b6fd7b31eb921 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 3 Aug 2019 11:35:15 +0200 Subject: [PATCH] approx_distance in Sol --- cell.cpp | 1 + sol.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cell.cpp b/cell.cpp index c88b182e..89fc9f7d 100644 --- a/cell.cpp +++ b/cell.cpp @@ -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; imove(i) == h2) return d + 1; diff --git a/sol.cpp b/sol.cpp index 1d90cced..b756f1f4 100644 --- a/sol.cpp +++ b/sol.cpp @@ -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 g(geometry, gBinary4); + dynamicval 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;"