From 94f4cd24afb2681b4793140a4c30da25e21a2894 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 2 Aug 2019 17:32:57 +0200 Subject: [PATCH] fixed build_shortest_path in arcm/Penrose euclidean --- cell.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cell.cpp b/cell.cpp index a0773c9b..d3289ded 100644 --- a/cell.cpp +++ b/cell.cpp @@ -1014,16 +1014,19 @@ vector build_shortest_path(cell *c1, cell *c2) { if(euclid) { using namespace hyperpoint_vec; p.push_back(c1); - hyperpoint h = tC0(calc_relative_matrix(c2, c1, C0)) - C0; + hyperpoint h = tC0(calc_relative_matrix(c2, c1, C0)); cell *x = c1; - hyperpoint h1 = C0; + transmatrix T1 = rspintox(h); int d = celldistance(c1, c2); - for(int i=0; i<=d * 10; i++) { - h1 += h / d / 10.; - virtualRebase(x, h1, true); + int steps = d * 10; + ld step = hdist0(h) / steps; + for(int i=0; i< steps; i++) { + T1 = T1 * xpush(step); + virtualRebase(x, T1, true); + println(hlog, "x = ", x, "p length = ", isize(p), " dist = ", hdist0(tC0(T1)), " dist from end = ", hdist(tC0(T1), tC0(calc_relative_matrix(c2, x, C0)))); while(x != p.back()) { forCellCM(c, p.back()) - if(celldistance(c, x) < celldistance(p.back(), x)) { + if(celldistance(x, c) < celldistance(x, p.back())) { p.push_back(c); break; }