mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-06-11 19:04:08 +00:00
shift_view with geodesic-movement disabled is now based on Lie exponentials (NYI: SL2, Berger)
This commit is contained in:
parent
97c7aef1a9
commit
1c907be9da
39
hypgraph.cpp
39
hypgraph.cpp
@ -2952,16 +2952,47 @@ EX void rotate_view(transmatrix T) {
|
|||||||
if(!prod && !rug::rugged) current_display->which_copy = T * current_display->which_copy;
|
if(!prod && !rug::rugged) current_display->which_copy = T * current_display->which_copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX hyperpoint lie_exp(hyperpoint h) {
|
||||||
|
if(nil) {
|
||||||
|
h[3] = 1;
|
||||||
|
h[2] += h[0] * h[1] / 2;
|
||||||
|
}
|
||||||
|
else if(sol) {
|
||||||
|
h[3] = 1;
|
||||||
|
h[0] *= (exp(-h[2]) - 1) / -h[2];
|
||||||
|
h[1] *= (exp(+h[2]) - 1) / h[2];
|
||||||
|
}
|
||||||
|
else if(sol && nih) {
|
||||||
|
h[3] = 1;
|
||||||
|
ld z = h[2] * log(2);
|
||||||
|
h[0] *= (exp(-z) - 1) / -z;
|
||||||
|
z = h[2] * log(3);
|
||||||
|
h[1] *= (exp(+z) - 1) / z;
|
||||||
|
}
|
||||||
|
else if(nih) {
|
||||||
|
h[3] = 1;
|
||||||
|
ld z = h[2] * log(2);
|
||||||
|
h[0] *= (exp(+z) - 1) / z;
|
||||||
|
z = h[2] * log(3);
|
||||||
|
h[1] *= (exp(+z) - 1) / z;
|
||||||
|
}
|
||||||
|
else if(sl2) {
|
||||||
|
/* not implemented */
|
||||||
|
}
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
/** shift the view according to the given tangent vector */
|
/** shift the view according to the given tangent vector */
|
||||||
EX transmatrix get_shift_view_of(const hyperpoint H, const transmatrix V) {
|
EX transmatrix get_shift_view_of(const hyperpoint H, const transmatrix V) {
|
||||||
if(!nonisotropic && !stretch::in()) {
|
if(!nonisotropic && !stretch::in()) {
|
||||||
return rgpushxto0(direct_exp(lp_iapply(H))) * V;
|
return rgpushxto0(direct_exp(lp_iapply(H))) * V;
|
||||||
}
|
}
|
||||||
else if(!nisot::geodesic_movement) {
|
else if(!nisot::geodesic_movement) {
|
||||||
transmatrix IV = view_inverse(V);
|
transmatrix IV = view_inverse(View);
|
||||||
nisot::fixmatrix(IV);
|
transmatrix view_shift = eupush( tC0(IV) );
|
||||||
const transmatrix V1 = iview_inverse(IV);
|
transmatrix rot = View * view_shift;
|
||||||
return V1 * eupush(IV * eupush(H) * V1 * C0);
|
hyperpoint tH = lie_exp(inverse(rot) * H);
|
||||||
|
return rot * eupush(tH) * inverse(view_shift);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return iview_inverse(nisot::parallel_transport(view_inverse(V), -H));
|
return iview_inverse(nisot::parallel_transport(view_inverse(V), -H));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user