From 201098efe9f08eef2622bfe9ddea7d4deb6a6fab Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 20 Aug 2019 14:56:00 +0200 Subject: [PATCH] convenience functions zforward_dir and zpush0 --- 3d-models.cpp | 1 + graph.cpp | 4 ++-- hyperpoint.cpp | 1 + mapeditor.cpp | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/3d-models.cpp b/3d-models.cpp index 8ee5cc4f..06915797 100644 --- a/3d-models.cpp +++ b/3d-models.cpp @@ -615,6 +615,7 @@ void geometry_information::animate_bird(hpcshape& orig, hpcshape_animated& anima } EX hyperpoint forward_dir(ld x) { return prod ? point3(x, 0, 0) : xpush0(x); } +EX hyperpoint zforward_dir(ld z) { return prod ? point3(0, 0, z) : zpush0(z); } EX hyperpoint dir_to_point(hyperpoint h) { return prod ? product::direct_exp(h) : h; } diff --git a/graph.cpp b/graph.cpp index 93de8b71..04a2d098 100644 --- a/graph.cpp +++ b/graph.cpp @@ -7227,9 +7227,9 @@ EX void precise_mouseover() { mouseover2 = mouseover = viewcenter(); ld best = HUGE_VAL; hyperpoint h = - prod ? product::direct_exp( inverse(nisot::local_perspective) * cspin(2, 0, M_PI/2) * forward_dir(1) ) : + prod ? product::direct_exp( inverse(nisot::local_perspective) * zforward_dir(1) ) : - nisot::local_perspective_used() ? inverse(nisot::local_perspective) * cpush(2, 1) * C0 : cpush(2, 1) * C0; + nisot::local_perspective_used() ? inverse(nisot::local_perspective) * zpush0(1) : zpush0(1); forCellEx(c1, mouseover2) { ld dist = hdist(tC0(ggmatrix(c1)), h); if(dist < best) mouseover = c1, best = dist; diff --git a/hyperpoint.cpp b/hyperpoint.cpp index 09ce2991..6b17a68b 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -1010,6 +1010,7 @@ inline hyperpoint xspinpush0(ld alpha, ld x) { inline hyperpoint xpush0(ld x) { return cpush0(0, x); } inline hyperpoint ypush0(ld x) { return cpush0(1, x); } +inline hyperpoint zpush0(ld x) { return cpush0(2, x); } // T * C0, optimized inline hyperpoint tC0(const transmatrix &T) { diff --git a/mapeditor.cpp b/mapeditor.cpp index d70ac2cb..1a970821 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -1114,7 +1114,7 @@ namespace mapeditor { unsigned gridcolor = 0xC0C0C040; hyperpoint in_front_dist(ld d) { - hyperpoint h = prod ? product::direct_exp( inverse(nisot::local_perspective) * cspin(2, 0, M_PI/2) * forward_dir(d) ) : cpush0(2, d); + hyperpoint h = prod ? product::direct_exp( inverse(nisot::local_perspective) * zforward_dir(d) ) : zpush0(d); if(nonisotropic && nisot::geodesic_movement) h = nisot::get_exp(inverse(nisot::local_perspective) * h, 100); return h; }