mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-27 09:24:53 +00:00
fixed build_shortest_path in 4-valent Euclidean tilings
This commit is contained in:
parent
8c38c3071c
commit
c14515c5ac
10
cell.cpp
10
cell.cpp
@ -881,7 +881,7 @@ vector<cell*> build_shortest_path(cell *c1, cell *c2) {
|
|||||||
if(geometry == gCrystal) return crystal::build_shortest_path(c1, c2);
|
if(geometry == gCrystal) return crystal::build_shortest_path(c1, c2);
|
||||||
#endif
|
#endif
|
||||||
vector<cell*> p;
|
vector<cell*> p;
|
||||||
if(euclid && DIM == 2) {
|
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)) - C0;
|
||||||
@ -891,7 +891,13 @@ vector<cell*> build_shortest_path(cell *c1, cell *c2) {
|
|||||||
for(int i=0; i<=d * 10; i++) {
|
for(int i=0; i<=d * 10; i++) {
|
||||||
h1 += h / d / 10.;
|
h1 += h / d / 10.;
|
||||||
virtualRebase(x, h1, true);
|
virtualRebase(x, h1, true);
|
||||||
if(x != p.back()) p.push_back(x);
|
while(x != p.back()) {
|
||||||
|
forCellCM(c, p.back())
|
||||||
|
if(celldistance(c, x) < celldistance(p.back(), x)) {
|
||||||
|
p.push_back(c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(isize(p) != d + 1)
|
if(isize(p) != d + 1)
|
||||||
println(hlog, "warning: path size ", isize(p), " should be ", d+1);
|
println(hlog, "warning: path size ", isize(p), " should be ", d+1);
|
||||||
|
Loading…
Reference in New Issue
Block a user