HyperRogue  11.3d
game/visualization engine based on non-Euclidean geometry
Classes | Namespaces | Typedefs | Functions | Variables
crystal.cpp File Reference

Multi-dimensional (aka crystal) geometries. More...

#include "hyper.h"

Classes

struct  hr::crystal::coord
 
struct  hr::crystal::ldcoord
 
struct  hr::crystal::crystal_structure
 
struct  hr::crystal::lwalker
 
struct  hr::crystal::east_structure
 
struct  hr::crystal::hrmap_crystal
 
struct  hr::crystal::eps_comparer
 
struct  hr::crystal::shift_data
 

Namespaces

 hr
 

Typedefs

typedef array< coord, 12 > hr::crystal::shifttable
 

Functions

EX bool hr::crystal::pure ()
 
EX ldcoord hr::crystal::told (coord c)
 
coord hr::crystal::roundcoord (ldcoord c)
 
int hr::crystal::tocode (int cname)
 
void hr::crystal::resize2 (vector< vector< int >> &v, int a, int b, int z)
 
lwalker hr::crystal::operator+ (lwalker a, int v)
 
lwalker hr::crystal::operator+ (lwalker a, wstep_t)
 
coord hr::crystal::add (coord c, lwalker a, int val)
 
coord hr::crystal::add (coord c, int cname, int val)
 
ld hr::crystal::sqhypot2 (crystal_structure &cs, ldcoord co1, ldcoord co2)
 
int hr::crystal::fiftyrule (coord c)
 
bool hr::crystal::is_bi (crystal_structure &cs, coord co)
 
shifttable hr::crystal::get_canonical (coord co)
 
hrmap_crystal * hr::crystal::crystal_map ()
 
EX heptagon * hr::crystal::get_heptagon_at (coord c)
 
EX coord hr::crystal::get_coord (heptagon *h)
 
EX ldcoord hr::crystal::get_ldcoord (cell *c)
 
EX int hr::crystal::get_dim ()
 
EX transmatrix hr::crystal::get_adj (heptagon *h, int d)
 
EX color_t hr::crystal::colorize (cell *c, char whichCanvas)
 
EX ld hr::crystal::compass_angle ()
 
EX bool hr::crystal::crystal_cell (cell *c, transmatrix V)
 
EX vector< cell * > hr::crystal::build_shortest_path (cell *c1, cell *c2)
 
EX int hr::crystal::precise_distance (cell *c1, cell *c2)
 
EX ld hr::crystal::space_distance (cell *c1, cell *c2)
 
EX ld hr::crystal::space_distance_camelot (cell *c)
 
EX int hr::crystal::dist_relative (cell *c)
 
EX int hr::crystal::dist_alt (cell *c)
 
EX void hr::crystal::init_rotation ()
 
EX void hr::crystal::random_rotation ()
 
EX void hr::crystal::next_home_orientation ()
 
EX void hr::crystal::flip_z ()
 
hyperpoint hr::crystal::coord_to_flat (ldcoord co, int dim=3)
 
EX void hr::crystal::switch_z_coordinate ()
 
EX void hr::crystal::apply_rotation (const transmatrix t)
 
EX void hr::crystal::centerrug (ld aspd)
 
void hr::crystal::cut_triangle2 (const hyperpoint pa, const hyperpoint pb, const hyperpoint pc, const hyperpoint ha, const hyperpoint hb, const hyperpoint hc)
 
void hr::crystal::cut_triangle (const hyperpoint pa, const hyperpoint pb, const hyperpoint pc, const hyperpoint ha, const hyperpoint hb, const hyperpoint hc)
 
EX void hr::crystal::build_rugdata ()
 
EX void hr::crystal::set_land (cell *c)
 
EX void hr::crystal::set_crystal (int sides)
 
void hr::crystal::test_crt ()
 
void hr::crystal::unit_test_tables ()
 
EX void hr::crystal::set_crystal_period_flags ()
 
int hr::crystal::readArgs ()
 
EX hrmap * hr::crystal::new_map ()
 
EX string hr::crystal::compass_help ()
 
string hr::crystal::make_help ()
 
EX void hr::crystal::show ()
 
bignum & hr::crystal::compute_volume (int dim, int rad)
 
EX string hr::crystal::get_table_volume ()
 
EX string hr::crystal::get_table_boundary ()
 
EX void hr::crystal::may_place_compass (cell *c)
 
euc::coord hr::crystal::crystal_to_euclid (coord x)
 
coord hr::crystal::euclid3_to_crystal (euc::coord x)
 
void hr::crystal::transform_crystal_to_euclid ()
 
void hr::crystal::transform_euclid_to_crystal ()
 
EX void hr::crystal::add_crystal_transform (char c)
 

Variables

EX bool hr::crystal::view_coordinates = false
 
bool hr::crystal::view_east = false
 
EX bool hr::crystal::used_compass_inside
 
EX ld hr::crystal::compass_probability = 1
 
const int hr::crystal::FULLSTEP = 2
 
const int hr::crystal::HALFSTEP = 1
 
const int hr::crystal::PERIOD = 2 * FULLSTEP
 
int hr::crystal::ctable [64][6]
 
int hr::crystal::crystal_period = 0
 
array< array< int, 2 >, MAX_EDGE_CRYSTAL > hr::crystal::distlimit_table
 
EX colortable hr::crystal::coordcolors = {0xD04040, 0x40D040, 0x4040D0, 0xFFD500, 0xF000F0, 0x00F0F0, 0xF0F0F0 }
 
array< array< ld, MAXDIM >, MAXDIM > hr::crystal::crug_rotation
 
int hr::crystal::ho = 1
 
ldcoord hr::crystal::rug_center
 
bool hr::crystal::draw_cut = false
 
ld hr::crystal::cut_level = 0
 
auto hr::crystal::crystalhook
 
map< pair< int, int >, bignum > hr::crystal::volume_memo
 
shift_data hr::crystal::shift_data_zero
 

Detailed Description

Multi-dimensional (aka crystal) geometries.

Function Documentation

◆ pure()

EX bool hr::crystal::pure ( )

Crystal can be bitruncated either by changing variation to bitruncated. In case of the 4D Crystal, the standard HyperRogue bitruncation becomes confused by having both the original and new vertices of degree 8. Hence Crystal implements its own bitruncation, which is selected/checked by setting ginf[gCrystal].vertex to 3. Additionally, this lets us double bitruncate. Function pure() checks for both kinds of bitruncation (or any other variations).

Variable Documentation

◆ FULLSTEP

const int hr::crystal::FULLSTEP = 2

in the "pure" form, the adjacent vertices are internaly spaced by 2

◆ HALFSTEP

const int hr::crystal::HALFSTEP = 1

to make space for the additional vertices which are added in the bitruncated version

◆ PERIOD

const int hr::crystal::PERIOD = 2 * FULLSTEP

with variations, the connections of the vertex at coordinate v+FULLSTEP mirror the connections of the vertex at coordinate v. Therefore, the period of our construction is actually 2*FULLSTEP.

◆ distlimit_table

array<array<int,2>, MAX_EDGE_CRYSTAL> hr::crystal::distlimit_table
Initial value:
= {{
{{SEE_ALL,SEE_ALL}}, {{SEE_ALL,SEE_ALL}}, {{SEE_ALL,SEE_ALL}}, {{SEE_ALL,SEE_ALL}}, {{15, 10}},
{{6, 4}}, {{5, 3}}, {{4, 3}}, {{4, 3}}, {{3, 2}}, {{3, 2}}, {{3, 2}}, {{3, 2}}, {{3, 2}}
}}

◆ crystalhook

auto hr::crystal::crystalhook
Initial value:
=
addHook(hooks_args, 100, readArgs)
+ addHook(hooks_drawcell, 100, crystal_cell)
+ addHook(hooks_tests, 200, unit_test_tables)