1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-27 18:40:35 +00:00

refactored get_logical_z

This commit is contained in:
Zeno Rogue 2023-01-07 11:45:40 +01:00
parent 57b762dfe8
commit 3f2a84be5f
2 changed files with 21 additions and 7 deletions

View File

@ -5078,12 +5078,7 @@ EX void make_actual_view() {
} }
hyperpoint h = tC0(view_inverse(actual_view_transform * View)); hyperpoint h = tC0(view_inverse(actual_view_transform * View));
if(geom3::euc_in_nil()) camera_level = h[1]; camera_level = get_logical_z(h);
else if(geom3::euc_in_solnih()) camera_level = h[2];
else if(geom3::hyp_in_solnih()) camera_level = h[0];
else if(gproduct) camera_level = log(h[2]);
else camera_level = asin_auto(h[2]);
if(moved_center()) camera_level--;
camera_sign = cgi.FLOOR > cgi.WALL; camera_sign = cgi.FLOOR > cgi.WALL;
} }

View File

@ -930,6 +930,25 @@ EX hyperpoint orthogonal_move(const hyperpoint& h, ld z) {
u *= cos_auto(z); u *= cos_auto(z);
return hpxy3(h[0] * u, h[1] * u, sinh(z)); return hpxy3(h[0] * u, h[1] * u, sinh(z));
} }
EX ld get_logical_z(hyperpoint h) {
if(geom3::euc_in_nil())
return h[1];
if(geom3::euc_in_solnih())
return h[2];
if(geom3::hyp_in_solnih())
return h[0];
if(geom3::euc_in_sl2())
return esl2_ati(h)[1];
if(geom3::euc_in_product()) {
ld bz = zlevel(h);
auto h1 = h / exp(bz);
return asin_auto(h1[1]);
}
if(gproduct)
return log(h[2]);
return asin_auto(h[2]) - (moved_center() ? 1 : 0);
}
#endif #endif
// push alpha units vertically // push alpha units vertically