From 276c47d7ffe08289ab173f0666f034731a3eed66 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 15 May 2019 09:36:44 +0200 Subject: [PATCH] 2D3D:: fixed radar in Euclidean --- graph.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/graph.cpp b/graph.cpp index 4bc3e66b..7c0ae010 100644 --- a/graph.cpp +++ b/graph.cpp @@ -706,9 +706,10 @@ void addradar(const transmatrix& V, char ch, color_t col, color_t outline) { using namespace hyperpoint_vec; ld d = hdist0(h); if(d > sightranges[geometry]) return; - if(WDIM == 3) - h = h * (d / sightranges[geometry] / hypot_d(3, h)); - else { + if(WDIM == 3) { + if(d) h = h * (d / sightranges[geometry] / hypot_d(3, h)); + } + else if(hyperbolic) { ld z = h[2] + h[1]/1000000; h[1] = hypot(h[1], h[2]) / (1 + h[3]); // we add h[1]/1000000 so that it also works for h[2] == 0 @@ -716,6 +717,13 @@ void addradar(const transmatrix& V, char ch, color_t col, color_t outline) { h[0] = h[0] / (1 + h[3]); h[2] = 0; } + else { + ld z = h[2] + h[1]/1000000; + if(d) h = h * (d / sightranges[geometry] / hypot_d(3, h)); + h[1] = hypot(h[1], h[2]) / (1 + h[3]); + if(z < 0) h[1] = -h[1]; + h[2] = 0; + } radarpoints.emplace_back(radarpoint{h, ch, col, outline}); }