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

nonisotropic spaces (Solv and Nil) More...

#include "hyper.h"

Classes

struct  hr::sn::tabled_inverses
 
struct  hr::sn::hrmap_solnih
 
struct  hr::nilv::mvec
 
struct  hr::nilv::nilstructure
 
struct  hr::nilv::hrmap_nil
 
struct  hr::hybrid::hrmap_hybrid
 
struct  hr::product::hrmap_product
 
struct  hr::rots::hrmap_rotation_space
 

Namespaces

 hr
 

Macros

#define S0(x, y, z)   get_int(x, y, z)[t]
 
#define S1(x, y)   (S0(x,y,az) * (bz-iz) + S0(x,y,bz) * (iz-az))
 
#define S2(x)   (S1(x,ay) * (by-iy) + S1(x,by) * (iy-ay))
 
#define PIU(x)   hr::hybrid::in_underlying_geometry([&] { return (x); })
 

Typedefs

typedef array< float, 3 > hr::sn::compressed_point
 

Functions

bool hr::nisot::local_perspective_used ()
 
EX transmatrix hr::nisot::translate (hyperpoint h)
 
EX bool hr::sn::in ()
 
EX eGeometry hr::sn::geom ()
 
hyperpoint hr::sn::decompress (compressed_point p)
 
compressed_point hr::sn::compress (hyperpoint h)
 
EX ld hr::sn::x_to_ix (ld u)
 
EX ld hr::sn::ix_to_x (ld ix)
 
EX ld hr::sn::z_to_iz (ld z)
 
EX ld hr::sn::iz_to_z (ld iz)
 
EX hyperpoint hr::sn::azeq_to_table (hyperpoint x)
 
EX hyperpoint hr::sn::table_to_azeq (hyperpoint x)
 
EX pair< heptagon *, heptagon * > hr::sn::getcoord (heptagon *h)
 
EX heptagon * hr::sn::get_at (heptagon *h1, heptagon *h2, bool gen)
 
hyperpoint hr::sn::christoffel (const hyperpoint at, const hyperpoint velocity, const hyperpoint transported)
 
EX hyperpoint hr::sn::get_inverse_exp_symsol (hyperpoint h, bool lazy, bool just_direction)
 
EX hyperpoint hr::sn::get_inverse_exp_nsym (hyperpoint h, bool lazy, bool just_direction)
 
EX bool hr::sn::in_table_range (hyperpoint h)
 
EX tabled_inverses & hr::sn::get_tabled ()
 
EX int hr::sn::approx_distance (heptagon *h1, heptagon *h2)
 
hyperpoint hr::nilv::christoffel (const hyperpoint Position, const hyperpoint Velocity, const hyperpoint Transported)
 
EX hyperpoint hr::nilv::formula_exp (hyperpoint v)
 
EX hyperpoint hr::nilv::get_inverse_exp (hyperpoint h, int iterations)
 
hyperpoint hr::nilv::mvec_to_point (mvec m)
 
EX nilstructure & hr::nilv::current_ns ()
 
EX transmatrix hr::nilv::adjmatrix (int i)
 
EX mvec hr::nilv::get_coord (heptagon *h)
 
EX heptagon * hr::nilv::get_heptagon_at (mvec m)
 
EX void hr::nilv::set_flags ()
 
EX hyperpoint hr::nilv::on_geodesic (hyperpoint s0, hyperpoint s1, ld x)
 
EX color_t hr::nilv::colorize (cell *c, char whichCanvas)
 
EX void hr::nilv::prepare_niltorus3 ()
 
EX void hr::nilv::show_niltorus3 ()
 
EX bool hr::in_s2xe ()
 
EX bool hr::in_h2xe ()
 
EX bool hr::in_e2xe ()
 
EX eGeometryClass hr::hybrid::under_class ()
 
EX void hr::hybrid::configure (eGeometry g)
 
EX void hr::hybrid::reconfigure ()
 
template<class T >
auto hr::hybrid::in_actual (const T &t) -> decltype(t())
 
hrmap_hybrid * hr::hybrid::hmap ()
 
EX cell * hr::hybrid::get_at (cell *base, int level)
 
EX pair< cell *, int > hr::hybrid::get_where (cell *c)
 
EX void hr::hybrid::find_cell_connection (cell *c, int d)
 
EX hrmap * hr::hybrid::get_umap ()
 
template<class T >
auto hr::hybrid::in_underlying_geometry (const T &f) -> decltype(f())
 
EX hyperpoint hr::hybrid::get_corner (cell *c, int i, int next, ld z)
 
EX int hr::hybrid::wall_offset (cell *c)
 
EX void hr::hybrid::will_link (cell *c)
 
EX void hr::hybrid::link ()
 
EX int hr::hybrid::celldistance (cell *c1, cell *c2)
 
EX hyperpoint hr::product::inverse_exp (hyperpoint h)
 
EX hyperpoint hr::product::direct_exp (hyperpoint h)
 
EX bool hr::product::validate_spin ()
 
EX void hr::product::show_config ()
 
EX hyperpoint hr::slr::from_phigans (hyperpoint h)
 
EX hyperpoint hr::slr::to_phigans (hyperpoint h)
 
hyperpoint hr::slr::christoffel (const hyperpoint Position, const hyperpoint Velocity, const hyperpoint Transported)
 
EX transmatrix hr::slr::translate (hyperpoint h)
 
hyperpoint hr::slr::polar (ld r, ld theta, ld phi)
 
hyperpoint hr::slr::xyz_point (ld x, ld y, ld z)
 
ld hr::slr::rootsin (ld square, ld s)
 
ld hr::slr::asin_it (ld z, int it)
 
ld hr::slr::arootsin (ld square, ld v, int it)
 
ld hr::slr::roottan (ld square, ld s)
 
hyperpoint hr::slr::geodesic_polar (ld alpha, ld beta, ld s)
 
EX hyperpoint hr::slr::formula_exp (hyperpoint h)
 
void hr::slr::find_alpha (ld phi, ld r, ld theta, ld &alpha, ld &s, ld &beta)
 
EX hyperpoint hr::slr::get_inverse_exp (hyperpoint h, ld index IS(0))
 
EX transmatrix hr::rots::uxpush (ld x)
 
EX transmatrix hr::rots::uypush (ld y)
 
EX transmatrix hr::rots::uzpush (ld z)
 
EX transmatrix hr::rots::qtm (hyperpoint h)
 
EX void hr::rots::draw_underlying (bool cornermode)
 
EX hyperpoint hr::nisot::christoffel (const hyperpoint at, const hyperpoint velocity, const hyperpoint transported)
 
EX bool hr::nisot::in_table_range (hyperpoint h)
 
EX void hr::nisot::geodesic_step (hyperpoint &at, hyperpoint &velocity)
 
EX hyperpoint hr::nisot::numerical_exp (hyperpoint v, int steps)
 
EX transmatrix hr::nisot::parallel_transport_bare (transmatrix Pos, hyperpoint h)
 
EX void hr::nisot::fixmatrix (transmatrix &T)
 
EX transmatrix hr::nisot::parallel_transport (const transmatrix Position, const hyperpoint direction)
 
EX transmatrix hr::nisot::spin_towards (const transmatrix Position, const hyperpoint goal)
 
EX hrmap * hr::nisot::new_map ()
 

Variables

EX bool hr::nisot::geodesic_movement = true
 
EX string hr::sn::common
 
EX string hr::sn::shader_symsol
 
EX string hr::sn::shader_nsymsol
 
EX string hr::sn::shader_nsym
 
EX ld hr::sn::solrange_xy = 15
 
EX ld hr::sn::solrange_z = 4
 
EX tabled_inverses hr::sn::solt = sn::tabled_inverses("solv-geodesics.dat")
 
EX tabled_inverses hr::sn::niht = sn::tabled_inverses("shyp-geodesics.dat")
 
EX tabled_inverses hr::sn::sont = sn::tabled_inverses("ssol-geodesics.dat")
 
EX string hr::nilv::nilshader
 
EX ld hr::nilv::nilwidth = 1
 
nilstructure hr::nilv::ns6
 
nilstructure hr::nilv::ns8
 
EX array< int, 3 > hr::nilv::nilperiod
 
EX array< int, 3 > hr::nilv::nilperiod_edit
 
int hr::nilv::S7_edit
 
EX eGeometry hr::hybrid::underlying
 
EX geometry_information * hr::hybrid::underlying_cgip
 
EX hrmap * hr::hybrid::pmap
 
EX geometry_information * hr::hybrid::pcgip
 
EX eGeometry hr::hybrid::actual_geometry
 
vector< cell * > hr::hybrid::to_link
 
EX bool hr::hybrid::in_link = false
 
int hr::product::z0
 
EX bool hr::product::current_spin_invalid
 
EX int hr::product::csteps
 
EX int hr::product::cspin
 
EX bool hr::product::cmirror
 
EX ld hr::slr::range_xy = 2
 
EX int hr::slr::steps = 15
 
EX string hr::slr::slshader
 
EX ld hr::rots::underlying_scale = 0
 
auto hr::nisot::config
 

Detailed Description

nonisotropic spaces (Solv and Nil)

Function Documentation

◆ christoffel()

hyperpoint hr::slr::christoffel ( const hyperpoint  Position,
const hyperpoint  Velocity,
const hyperpoint  Transported 
)

in the 'phigans' model

◆ asin_it()

ld hr::slr::asin_it ( ld  z,
int  it 
)

it==0 is standard asin, it==1 is the next solution (PI-asin)

◆ qtm()

EX transmatrix hr::rots::qtm ( hyperpoint  h)

reinterpret the given point of rotspace as a rotation matrix in the underlying geometry

Variable Documentation

◆ common

EX string hr::sn::common
Initial value:
=
"uniform mediump sampler3D tInvExpTable;"
"uniform mediump float PRECX, PRECY, PRECZ;"
"float x_to_ix(float u) {"
" if(u < 1e-6) return 0.;"
" float diag = u*u/2.;"
" float x = diag;"
" float y = u;"
" float z = diag+1.;"
" x /= (1.+z);"
" y /= (1.+z);"
" return 0.5 - atan((0.5-x) / y) / 3.1415926535897932384626433832795;"
" }"
"float z_to_iz_s(float z) {"
"return sinh(z) / (1. + cosh(z));"
"}"
"float z_to_iz_ns(float z) {"
"z = sinh(z) / (1. + cosh(z));"
"return (z+1.)/2.;"
"}"

◆ shader_symsol

EX string hr::sn::shader_symsol
Initial value:
= sn::common +
"vec4 inverse_exp(vec4 h) {"
"float ix = h[0] >= 0. ? x_to_ix(h[0]) : x_to_ix(-h[0]);"
"float iy = h[1] >= 0. ? x_to_ix(h[1]) : x_to_ix(-h[1]);"
"float iz = z_to_iz_s(h[2]);"
"if(h[2] < 1e-6) { iz = -iz; float s = ix; ix = iy; iy = s; }"
"if(iz < 0.) iz = 0.;"
"vec4 res;"
"float cx = ix*(1.-1./PRECX) + .5/PRECX;"
"float cy = iy*(1.-1./PRECY) + .5/PRECY;"
"float cz = iz*(1.-1./PRECZ) + .5/PRECZ;"
"if(ix > .65 + iz * .25 && iy > .55) res = vec4(0.,0.,0.,1.); "
"else "
"res = texture3D(tInvExpTable, vec3(cx, cy, cz));"
"if(h[2] < 1e-6) { res.xy = res.yx; res[2] = -res[2]; }"
"if(h[0] < 0.) res[0] = -res[0];"
"if(h[1] < 0.) res[1] = -res[1];"
"return res;"
"}"

◆ shader_nsym

EX string hr::sn::shader_nsym
Initial value:
= sn::common +
"vec4 inverse_exp(vec4 h) {"
"float ix = h[0] >= 0. ? x_to_ix(h[0]) : x_to_ix(-h[0]);"
"float iy = h[1] >= 0. ? x_to_ix(h[1]) : x_to_ix(-h[1]);"
"float iz = z_to_iz_ns(h[2]);"
"vec4 res;"
"float cx = ix*(1.-1./PRECX) + .5/PRECX;"
"float cy = iy*(1.-1./PRECY) + .5/PRECY;"
"float cz = iz*(1.-1./PRECZ) + .5/PRECZ;"
"res = texture3D(tInvExpTable, vec3(cx, cy, cz));"
"if(h[0] < 0.) res[0] = -res[0];"
"if(h[1] < 0.) res[1] = -res[1];"
"return res;"
"}"

◆ nilshader

EX string hr::nilv::nilshader
Initial value:
=
"vec4 inverse_exp(vec4 h) {"
"float wmin, wmax;"
"float side = h[2] - h[0] * h[1] / 2.;"
"if(h[0]*h[0] + h[1]*h[1] < 1e-12) return vec4(h[0], h[1], h[2], 1);"
"if(side > 1e-6) { wmin = 0.; wmax = 2.*PI; }"
"else if(side < -1e-6) { wmin = -2.*PI; wmax = 0.; }"
"else return vec4(h[0], h[1], 0., 1.);"
"float at = h[0] != 0. ? atan(h[1] / h[0]) : PI/2.;"
"float b = abs(h[0]) > abs(h[1]) ? h[0] / 2. / cos(at) : h[1] / 2. / sin(at);"
"float s = sin(2. * at);"
"for(int it=0; it<50; it++) {"
"float w = (wmin + wmax) / 2.;"
"float z = b * b * (s + (abs(w) < .1 ? w/3. + w*w*w/90. + w*w*w*w*w/2520.: (sin(w) - w)/(cos(w) - 1.))) + w;"
"if(h[2] > z) wmin = w;"
"else wmax = w;"
"}"
"float w = (wmin + wmax) / 2.;"
"float alpha = at - w/2.;"
"float c = b / sin(w/2.);"
"return vec4(c*w*cos(alpha), c*w*sin(alpha), w, 1.);"
"}"

◆ ns6

nilstructure hr::nilv::ns6
Initial value:
= {
{{ mvec(-1,0,0), mvec(0,-1,0), mvec(0,0,-1), mvec(1,0,0), mvec(0,1,0), mvec(0,0,1) }},
{{
{ point31(-0.5,-0.5,-0.25), point31(-0.5,-0.5,0.75), point31(-0.5,0.5,0.25), point31(-0.5,0.5,-0.75), },
{ point31(0.5,-0.5,-0.5), point31(0.5,-0.5,0.5), point31(-0.5,-0.5,0.5), point31(-0.5,-0.5,-0.5), },
{ point31(0,0,-0.5), point31(-0.5,0.5,-0.75), point31(-0.5,-0.5,-0.25), point31(0,0,-0.5), point31(-0.5,-0.5,-0.25), point31(-0.5,-0.5,-0.5), point31(0,0,-0.5), point31(-0.5,-0.5,-0.5), point31(0.5,-0.5,-0.5), point31(0,0,-0.5), point31(0.5,-0.5,-0.5), point31(0.5,-0.5,-0.75), point31(0,0,-0.5), point31(0.5,-0.5,-0.75), point31(0.5,0.5,-0.25), point31(0,0,-0.5), point31(0.5,0.5,-0.25), point31(0.5,0.5,-0.5), point31(0,0,-0.5), point31(0.5,0.5,-0.5), point31(-0.5,0.5,-0.5), point31(0,0,-0.5), point31(-0.5,0.5,-0.5), point31(-0.5,0.5,-0.75), },
{ point31(0.5,0.5,-0.25), point31(0.5,0.5,0.75), point31(0.5,-0.5,0.25), point31(0.5,-0.5,-0.75), },
{ point31(-0.5,0.5,-0.5), point31(-0.5,0.5,0.5), point31(0.5,0.5,0.5), point31(0.5,0.5,-0.5), },
{ point31(0,0,0.5), point31(-0.5,0.5,0.25), point31(-0.5,-0.5,0.75), point31(0,0,0.5), point31(-0.5,-0.5,0.75), point31(-0.5,-0.5,0.5), point31(0,0,0.5), point31(-0.5,-0.5,0.5), point31(0.5,-0.5,0.5), point31(0,0,0.5), point31(0.5,-0.5,0.5), point31(0.5,-0.5,0.25), point31(0,0,0.5), point31(0.5,-0.5,0.25), point31(0.5,0.5,0.75), point31(0,0,0.5), point31(0.5,0.5,0.75), point31(0.5,0.5,0.5), point31(0,0,0.5), point31(0.5,0.5,0.5), point31(-0.5,0.5,0.5), point31(0,0,0.5), point31(-0.5,0.5,0.5), point31(-0.5,0.5,0.25), },
}}
}

◆ ns8

nilstructure hr::nilv::ns8
Initial value:
= {
{{ mvec(-1,0,0), mvec(-1,0,1), mvec(0,-1,0), mvec(0,0,-1), mvec(1,0,0), mvec(1,0,-1), mvec(0,1,0), mvec(0,0,1) }},
{{
{ point31(-0.5,-0.5,-0.25), point31(-0.5,-0.5,0.75), point31(-0.5,0.5,-0.25), },
{ point31(-0.5,-0.5,0.75), point31(-0.5,0.5,0.75), point31(-0.5,0.5,-0.25), },
{ point31(-0.5,-0.5,-0.25), point31(-0.5,-0.5,0.75), point31(0.5,-0.5,0.25), point31(0.5,-0.5,-0.75), },
{ point31(-0.5,-0.5,-0.25), point31(-0.5,0.5,-0.25), point31(0.5,0.5,-0.75), point31(0.5,-0.5,-0.75), },
{ point31(0.5,0.5,0.25), point31(0.5,-0.5,0.25), point31(0.5,-0.5,-0.75), },
{ point31(0.5,0.5,-0.75), point31(0.5,0.5,0.25), point31(0.5,-0.5,-0.75), },
{ point31(-0.5,0.5,0.75), point31(-0.5,0.5,-0.25), point31(0.5,0.5,-0.75), point31(0.5,0.5,0.25), },
{ point31(-0.5,-0.5,0.75), point31(-0.5,0.5,0.75), point31(0.5,0.5,0.25), point31(0.5,-0.5,0.25), },
}}
}