mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 09:50:34 +00:00
crystal:: coordinate computation is exported now
This commit is contained in:
parent
f42fba3afe
commit
d3a3d4df5e
12
crystal.cpp
12
crystal.cpp
@ -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
11
hyper.h
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user