mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-18 15:00:26 +00:00
faster virtualRebase in Solv
This commit is contained in:
parent
0f0d0ff7a9
commit
50087e032a
@ -331,6 +331,43 @@ void virtualRebase(cell*& base, T& at, const U& check) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(geometry == gSol) {
|
||||
/** the general algorithm sometimes makes much more iterations than needed... try to approximate the geodesic */
|
||||
hyperpoint h = check(at);
|
||||
auto step = [&] (int i) {
|
||||
at = currentmap->adj(base, i) * at;
|
||||
base = base->cmove(i);
|
||||
h = check(at);
|
||||
};
|
||||
|
||||
auto nw = vid.binary_width * log(2);
|
||||
while(abs(h[0]) > 2) step(2);
|
||||
while(h[0] < -0.5 * nw) step(0);
|
||||
while(h[0] > +0.5 * nw) step(4);
|
||||
while(abs(h[1]) > 2) {
|
||||
step(6);
|
||||
while(h[0] < -0.5 * nw) step(0);
|
||||
while(h[0] > +0.5 * nw) step(4);
|
||||
}
|
||||
while(h[1] < -0.5 * nw) step(1);
|
||||
while(h[1] > +0.5 * nw) step(5);
|
||||
while(h[2] > 1) {
|
||||
step(6);
|
||||
while(h[0] < -0.5 * nw) step(0);
|
||||
while(h[0] > +0.5 * nw) step(4);
|
||||
while(h[1] < -0.5 * nw) step(1);
|
||||
while(h[1] > +0.5 * nw) step(5);
|
||||
}
|
||||
while(h[2] < -1) {
|
||||
step(2);
|
||||
while(h[0] < -0.5 * nw) step(0);
|
||||
while(h[0] > +0.5 * nw) step(4);
|
||||
while(h[1] < -0.5 * nw) step(1);
|
||||
while(h[1] > +0.5 * nw) step(5);
|
||||
}
|
||||
}
|
||||
/* todo variants of sol */
|
||||
|
||||
if(prod) {
|
||||
auto d = product_decompose(check(at)).first;
|
||||
while(d > cgi.plevel / 2) {
|
||||
|
Loading…
Reference in New Issue
Block a user