1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-07 08:54:07 +00:00

exported interface for horo_distance

This commit is contained in:
Zeno Rogue 2019-09-06 08:18:14 +02:00
parent 83fa6334d3
commit bd9c19d1b7

View File

@ -203,10 +203,18 @@ EX transmatrix calc_relative_matrix_help(cell *c, heptagon *h1) {
return gm * where; return gm * where;
} }
#if HDR
struct horo_distance { struct horo_distance {
ld a, b; ld a, b;
void become(hyperpoint h1) { void become(hyperpoint h1);
horo_distance(hyperpoint h) { become(h); }
horo_distance(hyperpoint h1, const transmatrix& T);
bool operator < (const horo_distance z) const;
};
#endif
void horo_distance::become(hyperpoint h1) {
if(sol) { if(sol) {
a = abs(h1[2]); a = abs(h1[2]);
b = hypot_d(2, h1); b = hypot_d(2, h1);
@ -223,9 +231,7 @@ struct horo_distance {
a = 0, b = intval(h1, C0); a = 0, b = intval(h1, C0);
} }
horo_distance(hyperpoint h) { become(h); } horo_distance::horo_distance(hyperpoint h1, const transmatrix& T) {
horo_distance(hyperpoint h1, const transmatrix& T) {
#if CAP_BT #if CAP_BT
if(binarytiling) become(inverse(T) * h1); if(binarytiling) become(inverse(T) * h1);
else else
@ -234,7 +240,8 @@ struct horo_distance {
else else
a = 0, b = intval(h1, tC0(T)); a = 0, b = intval(h1, tC0(T));
} }
bool operator < (const horo_distance z) {
bool horo_distance::operator < (const horo_distance z) const {
#if CAP_BT #if CAP_BT
if(binarytiling || sol) { if(binarytiling || sol) {
if(a < z.a-1e-6) return true; if(a < z.a-1e-6) return true;
@ -243,7 +250,6 @@ struct horo_distance {
#endif #endif
return b < z.b - 1e-4; return b < z.b - 1e-4;
} }
};
template<class T, class U> template<class T, class U>
void virtualRebase_cell(cell*& base, T& at, const U& check) { void virtualRebase_cell(cell*& base, T& at, const U& check) {