From eb4b7177f34c5f6d1a2e661238a168c42771e716 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 27 Dec 2023 16:28:08 +0100 Subject: [PATCH] rogueviz:: extra projection --- rogueviz/extra-projections.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/rogueviz/extra-projections.cpp b/rogueviz/extra-projections.cpp index f57fae51..3d7ec8a1 100644 --- a/rogueviz/extra-projections.cpp +++ b/rogueviz/extra-projections.cpp @@ -211,7 +211,26 @@ void add_extra_projections() { ret[1] = H[1] / H[0] * x; if(GDIM == 2) ret[2] = H[2] / H[0] * x; ret[LDIM] = 1; - models::ori_to_scr(H); + models::ori_to_scr(ret); + }); + + add_extra("point-ideal-point equidistant", mf::horocyclic | mf::orientation, [] (shiftpoint& H_orig, hyperpoint& H, hyperpoint& ret) { + find_zlev(H); + models::scr_to_ori(H); + + ld d0 = hdist0(H); + ld x = deparabolic13(H)[0]; + ld y2 = d0*d0 - x*x; + ld y = y2 > 0 ? sqrt(y2) : 0; + + ret[0] = x; + if(GDIM == 2) ret[1] = H[1] > 0 ? y : -y; + else if(GDIM == 3) { + ld r = hypot(H[1], H[2]); + if(r == 0) ret[1] = ret[2] = 0; + else ret[1] = y * H[1] / r, ret[2] = y * H[2] / r; + } + models::ori_to_scr(ret); }); }