mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-27 10:30:36 +00:00
fixed camera movement in ESL2
This commit is contained in:
parent
f02073a35f
commit
8136d9b554
@ -588,7 +588,7 @@ EX hyperpoint esl2_ati(hyperpoint h) {
|
||||
ld S = sqrt(U) * (a1 > 0 ? 1 : -1);
|
||||
ld x = -asinh(S);
|
||||
h = lorentz(0, 3, -x) * lorentz(1, 2, x) * h;
|
||||
ld y = h[3] ? atanh(h[1] / h[3]) : atanh(h[0] / h[2]);
|
||||
ld y = h[3]*h[3] > h[2]*h[2] ? atanh(h[1] / h[3]) : atanh(h[0] / h[2]);
|
||||
h = lorentz(0, 2, -y) * lorentz(1, 3, -y) * h;
|
||||
ld z = atan2(h[2], h[3]);
|
||||
return hyperpoint(x, y, z, 0);
|
||||
|
16
hypgraph.cpp
16
hypgraph.cpp
@ -3293,6 +3293,9 @@ EX transmatrix get_shift_view_of(const hyperpoint H, const transmatrix V, eShift
|
||||
}
|
||||
case smGeodesic:
|
||||
return iview_inverse(nisot::parallel_transport(view_inverse(V), -H));
|
||||
case smESL2: {
|
||||
return get_shift_view_embedded_of_esl2(V, esl2_ita0(lp_iapply(-H)));
|
||||
}
|
||||
default:
|
||||
throw hr_exception("unknown shift method (embedded not supported)");
|
||||
}
|
||||
@ -3338,14 +3341,7 @@ EX transmatrix get_shift_view_embedded_of_esl2(const transmatrix V, const hyperp
|
||||
transmatrix V1 = gpushxto0(h) * gpushxto0(IV*C0);
|
||||
transmatrix IV1 = view_inverse(V1);
|
||||
transmatrix rot1 = V1 * map_relative_push(IV1 * C0);
|
||||
return rot * inverse(rot1) * V1 * inverse(V);
|
||||
}
|
||||
|
||||
void shift_view_esl2(hyperpoint h) {
|
||||
transmatrix R = get_shift_view_embedded_of_esl2(View, h);
|
||||
View = R * View;
|
||||
auto& wc = current_display->which_copy;
|
||||
wc = R * wc;
|
||||
return rot * inverse(rot1) * V1;
|
||||
}
|
||||
|
||||
/** works in isotropic and product spaces */
|
||||
@ -3419,7 +3415,7 @@ EX void shift_view_to(shiftpoint H, eShiftMethod sm IS(shift_method(smaManualCam
|
||||
shift_view_by_matrix(gpushxto0(unshift(H)), sm);
|
||||
return;
|
||||
case smESL2:
|
||||
shift_view_esl2(lp_iapply(unshift(H)));
|
||||
shift_view(-lp_apply(esl2_ati(lp_iapply(unshift(H)))), sm);
|
||||
return;
|
||||
case smLie:
|
||||
shift_view(-lie_log(H), sm);
|
||||
@ -3439,7 +3435,7 @@ EX void shift_view_towards(shiftpoint H, ld l, eShiftMethod sm IS(shift_method(s
|
||||
shift_view_by_matrix(rspintox(unshift(H)) * xpush(-l) * spintox(unshift(H)), sm);
|
||||
return;
|
||||
case smESL2:
|
||||
shift_view_esl2(esl2_ita0(tangent_length(esl2_ati(lp_iapply(unshift(H))), l)));
|
||||
shift_view(-lp_apply(tangent_length(esl2_ati(lp_iapply(unshift(H))), l)));
|
||||
return;
|
||||
case smLie:
|
||||
shift_view(tangent_length(lie_log(H), -l), sm);
|
||||
|
Loading…
Reference in New Issue
Block a user