crystal:: coordinate computation is exported now

This commit is contained in:
Zeno Rogue 2019-01-28 21:40:26 +01:00
parent f42fba3afe
commit d3a3d4df5e
2 changed files with 15 additions and 8 deletions

View File

@ -24,14 +24,6 @@ bool view_east = false;
bool used_compass_inside;
const int MAXDIM = 7;
typedef array<int, MAXDIM> coord;
static const coord c0 = {};
typedef array<ld, MAXDIM> ldcoord;
static const ldcoord ldc0 = {};
ldcoord told(coord c) { ldcoord a; for(int i=0; i<MAXDIM; i++) a[i] = c[i]; return a; }
// strange number to prevent weird acting in case of precision errors
coord roundcoord(ldcoord c) { coord a; for(int i=0; i<MAXDIM; i++) a[i] = floor(c[i] + .5136); return a; }
@ -449,6 +441,10 @@ hrmap_crystal *crystal_map() {
return (hrmap_crystal*) currentmap;
}
heptagon *get_heptagon_at(coord c) { return crystal_map()->get_heptagon_at(c, S7); }
coord get_coord(heptagon *h) { return crystal_map()->hcoords[h]; }
ldcoord get_ldcoord(cell *c) { return crystal_map()->get_coord(c); }
bool is_bi(crystal_structure& cs, coord co) {
for(int i=0; i<cs.dim; i++) if(co[i] & HALFSTEP) return true;
return false;

11
hyper.h
View File

@ -4185,6 +4185,17 @@ namespace arcm {
}
namespace crystal {
static const int MAXDIM = 7;
typedef array<int, MAXDIM> coord;
static const coord c0 = {};
typedef array<ld, MAXDIM> ldcoord;
static const ldcoord ldc0 = {};
heptagon *get_heptagon_at(coord c);
coord get_coord(heptagon *h);
ldcoord get_ldcoord(cell *c);
extern colortable coordcolors;
extern ld compass_probability;
extern bool view_coordinates;