fixed hdist computation in SL, also fixed hpxy and hpxy

This commit is contained in:
Zeno Rogue 2019-08-24 20:29:10 +02:00
parent 50052f27f5
commit 47d309e408
3 changed files with 10 additions and 3 deletions

View File

@ -215,8 +215,10 @@ struct horo_distance {
b = intval(h1, C0);
a = abs(binary::horo_level(h1));
}
else
#endif
else if(hybri)
a = 0, b = hdist(h1, C0);
else
a = 0, b = intval(h1, C0);
}
@ -227,6 +229,8 @@ struct horo_distance {
if(binarytiling) become(inverse(T) * h1);
else
#endif
if(sol || hybri) become(inverse(T) * h1);
else
a = 0, b = intval(h1, tC0(T));
}
bool operator < (const horo_distance z) {

View File

@ -305,11 +305,11 @@ EX ld edge_of_triangle_with_angles(ld alpha, ld beta, ld gamma) {
}
hyperpoint hpxy(ld x, ld y) {
return hpxyz(x,y, translatable ? 1 : sphere ? sqrt(1-x*x-y*y) : sqrt(1+x*x+y*y));
return hpxyz(x,y, sl2 ? sqrt(1+x*x+y*y) : translatable ? 1 : sphere ? sqrt(1-x*x-y*y) : sqrt(1+x*x+y*y));
}
hyperpoint hpxy3(ld x, ld y, ld z) {
return hpxyz3(x,y,z, translatable ? 1 : sphere ? sqrt(1-x*x-y*y-z*z) : sqrt(1+x*x+y*y+z*z));
return hpxyz3(x,y,z, sl2 ? sqrt(1+x*x+y*y-z*z) :translatable ? 1 : sphere ? sqrt(1-x*x-y*y-z*z) : sqrt(1+x*x+y*y+z*z));
}
// a point (I hope this number needs no comments ;) )
@ -874,6 +874,8 @@ EX ld hdist(const hyperpoint& h1, const hyperpoint& h2) {
auto d2 = product_decompose(h2);
return hypot(PIU(hdist(d1.second, d2.second)), d1.first - d2.first);
}
case gcSL2:
return hdist0(inverse(slr::translate(h1)) * h2);
default:
if(iv < 0) return 0;
return sqrt(iv);

View File

@ -1039,6 +1039,7 @@ EX namespace slr {
struct hrmap_psl2 : hybrid::hrmap_hybrid {
virtual transmatrix relative_matrix(cell *c2, cell *c1, const struct hyperpoint& point_hint) override {
if(c1 == c2) return Id;
for(int i=0; i<c1->type; i++) if(c1->move(i) == c2) return adjmatrix(i, c1->c.spin(i));
if(gmatrix0.count(c2) && gmatrix0.count(c1))
return inverse(gmatrix0[c1]) * gmatrix0[c2];