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

geo_dist_q : like geo_dist but gives correct distance in elliptic space

This commit is contained in:
Zeno Rogue 2020-04-14 16:42:11 +02:00
parent 5c96a82f80
commit fef6894bbd

View File

@ -1197,6 +1197,12 @@ EX ld geo_dist(const hyperpoint h1, const hyperpoint h2, flagtype prec IS(pNORMA
return hypot_d(3, inverse_exp(inverse(nisot::translate(h1)) * h2, prec));
}
EX ld geo_dist_q(const hyperpoint h1, const hyperpoint h2, flagtype prec IS(pNORMAL)) {
auto d = geo_dist(h1, h2, prec);
if(elliptic && d > M_PI/2) return M_PI - d;
return d;
}
EX hyperpoint lp_iapply(const hyperpoint h) {
return nisot::local_perspective_used() ? inverse(NLP) * h : h;
}