1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 23:50:27 +00:00

fixed build_shortest_path in arcm/Penrose euclidean

This commit is contained in:
Zeno Rogue 2019-08-02 17:32:57 +02:00
parent 908bd13660
commit 94f4cd24af

View File

@ -1014,16 +1014,19 @@ vector<cell*> build_shortest_path(cell *c1, cell *c2) {
if(euclid) { if(euclid) {
using namespace hyperpoint_vec; using namespace hyperpoint_vec;
p.push_back(c1); 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; cell *x = c1;
hyperpoint h1 = C0; transmatrix T1 = rspintox(h);
int d = celldistance(c1, c2); int d = celldistance(c1, c2);
for(int i=0; i<=d * 10; i++) { int steps = d * 10;
h1 += h / d / 10.; ld step = hdist0(h) / steps;
virtualRebase(x, h1, true); 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()) { while(x != p.back()) {
forCellCM(c, 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); p.push_back(c);
break; break;
} }