1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-04 21:26:17 +00:00

embedded_plane:: safer pushing

This commit is contained in:
Zeno Rogue 2022-12-08 22:06:44 +01:00
parent 0c59d626bb
commit 69af3ee4e3

View File

@ -745,7 +745,7 @@ EX transmatrix cmirror(int cid) {
EX transmatrix xpush(ld alpha) { return cpush(0, alpha); } EX transmatrix xpush(ld alpha) { return cpush(0, alpha); }
EX transmatrix lxpush(ld alpha) { EX transmatrix lxpush(ld alpha) {
if(WDIM == 2 && GDIM == 3) { if(embedded_plane) {
geom3::light_flip(true); geom3::light_flip(true);
auto t = cpush(0, alpha); auto t = cpush(0, alpha);
geom3::light_flip(false); geom3::light_flip(false);
@ -1601,12 +1601,13 @@ EX transmatrix transpose(transmatrix T) {
} }
EX hyperpoint lspinpush0(ld alpha, ld x) { EX hyperpoint lspinpush0(ld alpha, ld x) {
geom3::light_flip(true); bool f = embedded_plane;
if(f) geom3::light_flip(true);
if(embedded_plane) throw hr_exception("still embedded plane");
hyperpoint h = xspinpush0(alpha, x); hyperpoint h = xspinpush0(alpha, x);
geom3::light_flip(false); if(f) geom3::light_flip(false);
swapmatrix(h); if(f) swapmatrix(h);
return h; return h;
// return spin(alpha) * lxpush(x) * C0;
} }
#if HDR #if HDR
@ -1627,16 +1628,6 @@ inline hyperpoint cpush0(int c, ld x) {
return h; return h;
} }
inline hyperpoint xspinpush0(ld alpha, ld x) {
if(sl2) return slr::polar(x, -alpha, 0);
if(embedded_plane) return lspinpush0(alpha, x);
hyperpoint h = Hypc;
h[LDIM] = cos_auto(x);
h[0] = sin_auto(x) * cos(alpha);
h[1] = sin_auto(x) * -sin(alpha);
return h;
}
inline hyperpoint xpush0(ld x) { return cpush0(0, x); } inline hyperpoint xpush0(ld x) { return cpush0(0, x); }
inline hyperpoint lxpush0(ld x) { return lxpush(x) * tile_center(); } inline hyperpoint lxpush0(ld x) { return lxpush(x) * tile_center(); }
inline hyperpoint ypush0(ld x) { return cpush0(1, x); } inline hyperpoint ypush0(ld x) { return cpush0(1, x); }
@ -1656,6 +1647,16 @@ inline shiftpoint tC0(const shiftmatrix &T) {
} }
#endif #endif
EX hyperpoint xspinpush0(ld alpha, ld x) {
if(sl2) return slr::polar(x, -alpha, 0);
if(embedded_plane) return lspinpush0(alpha, x);
hyperpoint h = Hypc;
h[LDIM] = cos_auto(x);
h[0] = sin_auto(x) * cos(alpha);
h[1] = sin_auto(x) * -sin(alpha);
return h;
}
/** tangent vector in the given direction */ /** tangent vector in the given direction */
EX hyperpoint ctangent(int c, ld x) { return point3(c==0?x:0, c==1?x:0, c==2?x:0); } EX hyperpoint ctangent(int c, ld x) { return point3(c==0?x:0, c==1?x:0, c==2?x:0); }