1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-09-19 10:19:36 +00:00

fixup to last

This commit is contained in:
Zeno Rogue 2024-07-15 13:26:00 +02:00
parent 0d85a6943f
commit 228bc345ed
2 changed files with 30 additions and 0 deletions

View File

@ -174,6 +174,8 @@ inline shiftpoint shiftless(const hyperpoint& h, ld shift = 0) {
struct shiftmatrix {
transmatrix T;
ld shift;
shiftmatrix() {}
shiftmatrix(const transmatrix& _h, ld _shift) : T(_h), shift(_shift) {}
hyperpoint& operator [] (int i) { return T[i]; }
const hyperpoint& operator [] (int i) const { return T[i]; }
inline friend shiftpoint operator * (const shiftmatrix& T, const hyperpoint& h) {

View File

@ -2622,6 +2622,34 @@ EX namespace twist {
return res;
}
EX void queueline_correct(shiftpoint h1, shiftpoint h2, color_t col, int prec, PPR prio) {
optimize_shift(h1);
optimize_shift(h2);
shiftmatrix T(rgpushxto0(h1.h), h1.shift);
shiftpoint h = nmul(rots::ninverse(T), h2);
hyperpoint z = inverse_exp(h);
ld bonus = 0;
int steps = ceil(hypot_d(3, z) * pow(2, prec));
for(int i=0; i<=steps; i++) {
shiftpoint next = formula_exp(z * i / steps);
curvepoint(unshift(next, bonus));
if(abs(next.shift - bonus) > 1) {
queuecurve(T, col, 0, prio);
bonus = next.shift; T.shift = h1.shift + bonus;
curvepoint(unshift(next, bonus));
}
}
queuecurve(T, col, 0, prio);
}
/** @brief exponential function for both slr and Berger sphere */
EX shiftpoint formula_exp(hyperpoint vel) {