diff --git a/config.cpp b/config.cpp index d32213cd..3aa16ea6 100644 --- a/config.cpp +++ b/config.cpp @@ -687,7 +687,7 @@ EX void initConfig() { param_i(vid.mobilecompasssize, "mobile compass size", 0); // ISMOBILE || ISPANDORA ? 30 : 0); param_i(vid.radarsize, "radarsize size", 120); - addsaver(vid.radarrange, "radarrange", 2.5); + param_f(vid.radarrange, "radarrange", 2.5); param_i(vid.axes, "movement help", 1); param_b(vid.axes3, "movement help3", true); param_i(vid.shifttarget, "shift-targetting", 2); @@ -2405,7 +2405,7 @@ EX void show3D() { edit_levellines('L'); - if(WDIM == 3 || (GDIM == 3 && euclid)) { + if(WDIM == 3 || (GDIM == 3 && meuclid)) { dialog::addSelItem(XLAT("radar range"), fts(vid.radarrange), 'R'); dialog::add_action([] () { dialog::editNumber(vid.radarrange, 0, 10, 0.5, 2, "", XLAT("")); diff --git a/graph.cpp b/graph.cpp index 44f9842c..2cbcffbe 100644 --- a/graph.cpp +++ b/graph.cpp @@ -5092,18 +5092,33 @@ EX void make_actual_view() { #endif #if MAXMDIM >= 4 if(embedded_plane) { - transmatrix T = actual_view_transform * View; - transmatrix U = view_inverse(T); - - if(T[0][2] || T[1][2]) - T = spin(-atan2(T[0][2], T[1][2])) * T; - if(T[1][2] || T[2][2]) - T = cspin(1, 2, -atan2(T[1][2], T[2][2])) * T; + if(nonisotropic) { + transmatrix T = actual_view_transform * View; + ld z = -tC0(view_inverse(T)) [2]; + transmatrix R = actual_view_transform; + R = (logical_to_actual()) * R; + if(R[0][2] || R[2][2]) + R = cspin(0, 2, -atan2(R[0][2], R[2][2])) * R; + if(R[1][2] || R[2][2]) + R = cspin(1, 2, -atan2(R[1][2], R[2][2])) * R; + if(geom3::hyp_in_solnih()) R = Id; + R = inverse(logical_to_actual()) * R; + current_display->radar_transform = inverse(R) * zpush(-z); + } + else { + transmatrix T = actual_view_transform * View; + transmatrix U = view_inverse(T); - ld z = -asin_auto(tC0(view_inverse(T)) [2]); - T = zpush(-z) * T; + if(T[0][2] || T[1][2]) + T = spin(-atan2(T[0][2], T[1][2])) * T; + if(T[1][2] || T[2][2]) + T = cspin(1, 2, -atan2(T[1][2], T[2][2])) * T; - current_display->radar_transform = T * U; + ld z = -asin_auto(tC0(view_inverse(T)) [2]); + T = zpush(-z) * T; + + current_display->radar_transform = T * U; + } } #endif Viewbase = View; diff --git a/hyperpoint.cpp b/hyperpoint.cpp index 902ad248..65ecc2db 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -956,7 +956,7 @@ EX void swapmatrix(hyperpoint& h) { EX transmatrix parabolic1(ld u) { if(euclid) return ypush(u); - else if(geom3::hyp_in_solnih()) { + else if(geom3::hyp_in_solnih() && !geom3::flipped) { return ypush(u); } else { diff --git a/radar.cpp b/radar.cpp index 4c9ab139..2d65479d 100644 --- a/radar.cpp +++ b/radar.cpp @@ -3,13 +3,13 @@ namespace hr { #if MAXMDIM >= 4 pair makeradar(shiftpoint h) { - if(GDIM == 3 && WDIM == 2) h.h = current_display->radar_transform * h.h; + if(embedded_plane) h.h = current_display->radar_transform * h.h; ld d = hdist0(h); hyperpoint h1; - if(sol && nisot::geodesic_movement) { + if(sol && nisot::geodesic_movement && !embedded_plane) { hyperpoint h1 = inverse_exp(h, pQUICK); ld r = hypot_d(3, h1); if(r < 1) h1 = h1 * (atanh(r) / r); @@ -19,28 +19,53 @@ pair makeradar(shiftpoint h) { else if(sl2) h1 = slr::get_inverse_exp(h); else h1 = unshift(h); - if(nisot::local_perspective_used()) h1 = NLP * h1; + if(nisot::local_perspective_used() && !embedded_plane) { + h1 = NLP * h1; + } if(WDIM == 3) { if(d >= vid.radarrange) return {false, h1}; if(d) h1 = h1 * (d / vid.radarrange / hypot_d(3, h1)); } - else if(hyperbolic) { - for(int a=0; a<3; a++) h1[a] = h1[a] / (1 + h[3]); + else if(mhyperbolic) { + if(geom3::hyp_in_solnih()) { + geom3::light_flip(true); + h1 = parabolic1(h1[1]) * xpush0(h1[0]); + geom3::light_flip(false); + h1[3] = h1[2]; h1[2] = 0; + // h1 = current_display->radar_transform * h1; + } + for(int a=0; a<3; a++) h1[a] = h1[a] / (1 + h1[3]); } - else if(sphere) { - h1[2] = h1[3]; + else if(msphere) { + if(geom3::same_in_same()) h1[2] = h1[3]; + if(geom3::sph_in_hyp()) h1 /= sinh(1); } else { - if(d > vid.radarrange) return {false, h1}; - if(d) h1 = h1 * (d / (vid.radarrange + cgi.scalefactor/4) / hypot_d(3, h1)); + if(geom3::euc_in_hyp()) { + for(int a=0; a<3; a++) h1[a] = h1[a] / (1 + h1[3]); + h1[2] -= 1; + h1 *= 2 / sqhypot_d(3, h1); + d = hypot_d(2, h1); + if(d > vid.radarrange) return {false, h1}; + if(d) h1 = h1 / (vid.radarrange + cgi.scalefactor/4); + } + else if(geom3::same_in_same()) { + if(d > vid.radarrange) return {false, h1}; + if(d) h1 = h1 * (d / (vid.radarrange + cgi.scalefactor/4) / hypot_d(3, h1)); + } + else { + d = hypot_d(2, h1); + if(d > vid.radarrange) return {false, h1}; + if(d) h1 = h1 / (vid.radarrange + cgi.scalefactor/4); + } } if(invalid_point(h1)) return {false, h1}; return {true, h1}; } EX void addradar(const shiftmatrix& V, char ch, color_t col, color_t outline) { - shiftpoint h = tC0(V); + shiftpoint h = V * tile_center(); auto hp = makeradar(h); if(hp.first) current_display->radarpoints.emplace_back(radarpoint{hp.second, ch, col, outline});