1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 01:00:25 +00:00

fixes to parabolic

This commit is contained in:
Zeno Rogue 2021-10-07 13:23:44 +02:00
parent 8217fb474e
commit b866647622
3 changed files with 16 additions and 22 deletions

View File

@ -728,7 +728,7 @@ EX transmatrix parabolic1(ld u) {
EX transmatrix parabolic13(ld u, ld v) {
if(euclid)
return ypush(u);
return eupush3(0, u, v);
else {
ld diag = (u*u+v*v)/2;
return matrix4(
@ -740,27 +740,21 @@ EX transmatrix parabolic13(ld u, ld v) {
}
}
EX hyperpoint parabolic10(hyperpoint h) {
if(euclid) { h[LDIM] = 1; return h; }
else if(MDIM == 4) return hyperpoint(sinh(h[0]), h[1]/exp(h[0]), h[2]/exp(h[0]), cosh(h[0]));
else return hyperpoint(sinh(h[0]), h[1]/exp(h[0]), cosh(h[0]), 0);
}
EX hyperpoint deparabolic10(const hyperpoint h) {
if(euclid) return h;
ld x = -log(h[LDIM] - h[0]);
if(MDIM == 3) return hyperpoint(x, h[1] * exp(x), 1, 0);
return point31(x, h[1] * exp(x), h[2] * exp(x));
}
/** this looks correct */
EX hyperpoint deparabolic13(hyperpoint h) {
h /= (1 + h[3]);
hyperpoint one = point3(1,0,0);
h -= one;
h /= sqhypot_d(3, h);
if(euclid) return h;
h /= (1 + h[LDIM]);
h[0] -= 1;
h /= sqhypot_d(LDIM, h);
h[0] += .5;
return point3(log(2) + log(-h[0]), h[1] * 2, h[2] * 2);
return point3(log(2) + log(-h[0]), h[1] * 2, LDIM==3 ? h[2] * 2 : 0);
}
EX hyperpoint parabolic13(hyperpoint h) {
if(euclid) return h;
else if(LDIM == 3)
return parabolic13(h[1], h[2]) * xpush0(h[0]);
else
return parabolic1(h[1]) * xpush0(h[0]);
}
EX transmatrix spintoc(const hyperpoint& H, int t, int f) {

View File

@ -723,7 +723,7 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
models::apply_orientation(H[0], H[1]);
}
ret = hyperbolic ? deparabolic10(H) : H;
ret = hyperbolic ? deparabolic13(H) : H;
ret *= .5;
ret[LDIM] = 1;

View File

@ -772,7 +772,7 @@ hyperpoint ray_kleinize(hyperpoint h, int id, ld pz) {
if(hyperbolic && bt::in()) {
// ld co = vid.binary_width / log(2) / 4;
// hyperpoint res = point31(h[2]*log(2)/2, h[0]*co, h[1]*co);
return deparabolic10(bt::parabolic3(h[0], h[1]) * xpush0(log(2)/2*h[2]));
return deparabolic13(bt::bt_to_minkowski(h));
}
#endif
if(prod) {