convenience functions zforward_dir and zpush0

This commit is contained in:
Zeno Rogue 2019-08-20 14:56:00 +02:00
parent afa6d722dd
commit 201098efe9
4 changed files with 5 additions and 3 deletions

View File

@ -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; }

View File

@ -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;

View File

@ -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) {

View File

@ -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;
}