1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-20 04:09:59 +00:00

renamed solnihv:: to sn:: and solnih to sn::in()

This commit is contained in:
Zeno Rogue 2019-12-14 12:28:45 +01:00
parent 3f0e8851ae
commit 769982040d
14 changed files with 67 additions and 66 deletions

View File

@ -446,7 +446,7 @@ EX int celldist(cell *c) {
return hybrid::celldistance(c, currentmap->gamestart());
if(nil && !quotient) return DISTANCE_UNKNOWN;
if(euclid) return celldistance(currentmap->gamestart(), c);
if(sphere || bt::in() || WDIM == 3 || cryst || solnih || kite::in()) return celldistance(currentmap->gamestart(), c);
if(sphere || bt::in() || WDIM == 3 || cryst || sn::in() || kite::in()) return celldistance(currentmap->gamestart(), c);
#if CAP_IRR
if(IRREGULAR) return irr::celldist(c, false);
#endif
@ -477,7 +477,7 @@ EX int celldistAlt(cell *c) {
return d;
}
#if CAP_BT
if(bt::in() || solnih) return c->master->distance + (specialland == laCamelot && !tactic::on? 30 : 0);
if(bt::in() || sn::in()) return c->master->distance + (specialland == laCamelot && !tactic::on? 30 : 0);
#endif
if(nil) return c->master->zebraval + abs(c->master->emeraldval) + (specialland == laCamelot && !tactic::on? 30 : 0);;
#if CAP_CRYSTAL
@ -914,7 +914,7 @@ EX int heptdistance(heptagon *h1, heptagon *h2) {
if(cryst) return crystal::space_distance(h1->c7, h2->c7);
#endif
#if CAP_SOLV
if(solnih) return solnihv::approx_distance(h1, h2);
if(sn::in()) return sn::approx_distance(h1, h2);
#endif
while(true) {
if(h1 == h2) return d;
@ -1017,7 +1017,7 @@ EX int celldistance(cell *c1, cell *c2) {
return euc::cyldist(euc2_coordinates(c1), euc2_coordinates(c2));
}
if(arcm::in() || quotient || solnih || (kite::in() && euclid) || experimental || sl2 || nil) {
if(arcm::in() || quotient || sn::in() || (kite::in() && euclid) || experimental || sl2 || nil) {
if(saved_distances.count(make_pair(c1,c2)))
return saved_distances[make_pair(c1,c2)];

View File

@ -525,8 +525,8 @@ EX void initConfig() {
addsaver(vid.cells_generated_limit, "limit on cells generated", 250);
#if CAP_SOLV
addsaver(solnihv::solrange_xy, "solrange-xy");
addsaver(solnihv::solrange_z, "solrange-z");
addsaver(sn::solrange_xy, "solrange-xy");
addsaver(sn::solrange_z, "solrange-z");
#endif
addsaver(slr::steps, "slr-steps");
addsaver(slr::range_xy, "slr-range-xy");
@ -901,16 +901,16 @@ EX void edit_sightrange() {
dialog::editNumber(sightranges[geometry], 0, 10, 0.5, M_PI, solhelp(), "");
dialog::extra_options = xo; popScreen();
});
dialog::addSelItem(XLAT("max difference in X/Y coordinates"), fts(solnihv::solrange_xy), 'X');
dialog::addSelItem(XLAT("max difference in X/Y coordinates"), fts(sn::solrange_xy), 'X');
dialog::add_action([] {
auto xo = dialog::extra_options;
dialog::editNumber(solnihv::solrange_xy, 0.01, 200, 0.1, 50, XLAT("max difference in X/Y coordinates"), solhelp()), dialog::scaleLog();
dialog::editNumber(sn::solrange_xy, 0.01, 200, 0.1, 50, XLAT("max difference in X/Y coordinates"), solhelp()), dialog::scaleLog();
dialog::extra_options = xo; popScreen();
});
dialog::addSelItem(XLAT("max difference in Z coordinate"), fts(solnihv::solrange_z), 'Z');
dialog::addSelItem(XLAT("max difference in Z coordinate"), fts(sn::solrange_z), 'Z');
dialog::add_action([] {
auto xo = dialog::extra_options;
dialog::editNumber(solnihv::solrange_z, 0, 20, 0.1, 6, XLAT("max difference in Z coordinates"), solhelp());
dialog::editNumber(sn::solrange_z, 0, 20, 0.1, 6, XLAT("max difference in Z coordinates"), solhelp());
dialog::extra_options = xo; popScreen();
});
#endif
@ -987,7 +987,7 @@ EX void menuitem_sightrange(char c IS('c')) {
dialog::addSelItem(XLAT("minimum visible cell in pixels"), fts(WDIM == 3 ? vid.smart_range_detail_3 : vid.smart_range_detail), c);
#if CAP_SOLV
else if(pmodel == mdGeodesic && sol)
dialog::addSelItem(XLAT("3D sight range"), fts(solnihv::solrange_xy) + "x" + fts(solnihv::solrange_z), c);
dialog::addSelItem(XLAT("3D sight range"), fts(sn::solrange_xy) + "x" + fts(sn::solrange_z), c);
#endif
else if(WDIM == 3)
dialog::addSelItem(XLAT("3D sight range"), fts(sightranges[geometry]), c);

View File

@ -376,7 +376,7 @@ void ge_select_tiling() {
}
EX string current_proj_name() {
bool h = hyperbolic || solnih;
bool h = hyperbolic || sn::in();
if(pmodel != mdDisk)
return models::get_model_name(pmodel);
else if(h && vid.alpha == 1)
@ -414,7 +414,7 @@ EX string geometry_name() {
case gcSolNIH:
#if CAP_SOLV
switch(solnihv::geom()) {
switch(sn::geom()) {
case gSol:
return XLAT("Sol");
case gNIH:

View File

@ -179,7 +179,7 @@ struct horo_distance {
#endif
void horo_distance::become(hyperpoint h1) {
if(solnih) {
if(sn::in()) {
a = abs(h1[2]);
if(asonov::in()) h1 = asonov::straighten * h1;
b = hypot_d(2, h1);
@ -201,14 +201,14 @@ horo_distance::horo_distance(hyperpoint h1, const transmatrix& T) {
if(bt::in()) become(inverse(T) * h1);
else
#endif
if(solnih || hybri || nil) become(inverse(T) * h1);
if(sn::in() || hybri || nil) become(inverse(T) * h1);
else
a = 0, b = intval(h1, tC0(T));
}
bool horo_distance::operator < (const horo_distance z) const {
#if CAP_BT
if(bt::in() || solnih) {
if(bt::in() || sn::in()) {
if(a < z.a-1e-6) return true;
if(a > z.a+1e-6) return false;
}

View File

@ -3571,7 +3571,7 @@ bool celldrawer::cell_clipped() {
}
noclipped++;
}
if(pmodel == mdGeodesic && solnih) {
if(pmodel == mdGeodesic && sn::in()) {
hyperpoint H = tC0(V);
if(abs(H[0]) <= 3 && abs(H[1]) <= 3 && abs(H[2]) <= 3 ) ;
else {

View File

@ -129,7 +129,6 @@ void addMessage(string s, char spamtype = 0);
#define cgclass (cginf.cclass)
#define euclid (cgclass == gcEuclid)
#define sphere (cgclass == gcSphere)
#define solnih (cgclass == gcSolNIH)
#define sol (cgflags & qSOL)
#define nih (cgflags & qNIH)
#define nil (cgclass == gcNil)
@ -137,7 +136,7 @@ void addMessage(string s, char spamtype = 0);
#define prod (cgclass == gcProduct)
#define hybri (cgflags & qHYBRID)
#define hyperbolic (cgclass == gcHyperbolic)
#define nonisotropic (sol || nil || sl2 || nih)
#define nonisotropic (among(cgclass, gcSolNIH, gcNil, gcSL2))
#define translatable (euclid || nonisotropic)
#define nonorientable (cgflags & qNONORIENTABLE)
#define elliptic (cgflags & qELLIPTIC)

View File

@ -1131,7 +1131,7 @@ EX hyperpoint tangent_length(hyperpoint dir, ld length) {
/** exponential function: follow the geodesic given by v */
EX hyperpoint direct_exp(hyperpoint v, int steps) {
if(solnih) return nisot::numerical_exp(v, steps);
if(sn::in()) return nisot::numerical_exp(v, steps);
if(nil) return nilv::formula_exp(v);
if(sl2) return slr::formula_exp(v);
if(prod) return product::direct_exp(v);
@ -1148,11 +1148,11 @@ enum iePrecision { iLazy, iTable };
/** inverse exponential function \see hr::direct_exp */
EX hyperpoint inverse_exp(const hyperpoint h, iePrecision p, bool just_direction IS(true)) {
#if CAP_SOLV
if(solnih) {
if(sn::in()) {
if(nih)
return solnihv::get_inverse_exp_nsym(h, p == iLazy, just_direction);
return sn::get_inverse_exp_nsym(h, p == iLazy, just_direction);
else
return solnihv::get_inverse_exp_symsol(h, p == iLazy, just_direction);
return sn::get_inverse_exp_symsol(h, p == iLazy, just_direction);
}
#endif
if(nil) return nilv::get_inverse_exp(h, p == iLazy ? 5 : 20);

View File

@ -362,7 +362,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
if(nonisotropic) {
ret = lp_apply(inverse_exp(H, iTable, true));
ld w;
if(solnih) {
if(sn::in()) {
// w = 1 / sqrt(1 - sqhypot_d(3, ret));
// w = w / (vid.alpha + w);
w = 1 / (sqrt(1 - sqhypot_d(3, ret)) * vid.alpha + 1);
@ -1027,7 +1027,7 @@ EX bool in_smart_range(const transmatrix& T) {
if(invalid_point(h)) return false;
if(nil || nih) return true;
#if CAP_SOLV
if(pmodel == mdGeodesic) return solnihv::in_table_range(h);
if(pmodel == mdGeodesic) return sn::in_table_range(h);
#endif
hyperpoint h1;
applymodel(h, h1);

View File

@ -2606,7 +2606,7 @@ EX void setdist(cell *c, int d, cell *from) {
if(d >= BARLEV) {
if(bt::in() && WDIM == 3 && !c->land && !solnih) {
if(bt::in() && WDIM == 3 && !c->land && !sn::in()) {
ld z = vid.binary_width;
cell *cseek = c;
int step = 0;

View File

@ -44,7 +44,9 @@ EX namespace nisot {
EX }
#if CAP_SOLV
EX namespace solnihv {
EX namespace sn {
EX bool in() { return cgclass == gcSolNIH; }
EX eGeometry geom() {
if(asonov::in()) return gSol;
@ -487,8 +489,8 @@ EX namespace solnihv {
auto& s = get_tabled();
s.load();
ld ix = h[0] >= 0. ? solnihv::x_to_ix(h[0]) : solnihv::x_to_ix(-h[0]);
ld iy = h[1] >= 0. ? solnihv::x_to_ix(h[1]) : solnihv::x_to_ix(-h[1]);
ld ix = h[0] >= 0. ? sn::x_to_ix(h[0]) : sn::x_to_ix(-h[0]);
ld iy = h[1] >= 0. ? sn::x_to_ix(h[1]) : sn::x_to_ix(-h[1]);
ld iz = tanh(h[2]);
if(h[2] < 0.) { iz = -iz; swap(ix, iy); }
@ -512,8 +514,8 @@ EX namespace solnihv {
auto& s = get_tabled();
s.load();
ld ix = h[0] >= 0. ? solnihv::x_to_ix(h[0]) : solnihv::x_to_ix(-h[0]);
ld iy = h[1] >= 0. ? solnihv::x_to_ix(h[1]) : solnihv::x_to_ix(-h[1]);
ld ix = h[0] >= 0. ? sn::x_to_ix(h[0]) : sn::x_to_ix(-h[0]);
ld iy = h[1] >= 0. ? sn::x_to_ix(h[1]) : sn::x_to_ix(-h[1]);
ld iz = (tanh(h[2]/4)+1)/2;
hyperpoint res = s.get(ix, iy, iz, lazy);
@ -530,7 +532,7 @@ EX namespace solnihv {
return res;
}
EX string shader_symsol = solnihv::common +
EX string shader_symsol = sn::common +
"vec4 inverse_exp(vec4 h) {"
@ -561,7 +563,7 @@ EX namespace solnihv {
"return res;"
"}";
EX string shader_nsymsol = solnihv::common + R"*(
EX string shader_nsymsol = sn::common + R"*(
vec4 inverse_exp(vec4 h) {
@ -599,7 +601,7 @@ EX namespace solnihv {
return res;
})*";
EX string shader_nsym = solnihv::common +
EX string shader_nsym = sn::common +
"vec4 inverse_exp(vec4 h) {"
@ -628,9 +630,9 @@ EX namespace solnihv {
return abs(h[0]) < solrange_xy && abs(h[1]) < solrange_xy && abs(h[2]) < solrange_z;
}
EX tabled_inverses solt = solnihv::tabled_inverses("solv-geodesics.dat");
EX tabled_inverses niht = solnihv::tabled_inverses("shyp-geodesics.dat");
EX tabled_inverses sont = solnihv::tabled_inverses("ssol-geodesics.dat");
EX tabled_inverses solt = sn::tabled_inverses("solv-geodesics.dat");
EX tabled_inverses niht = sn::tabled_inverses("shyp-geodesics.dat");
EX tabled_inverses sont = sn::tabled_inverses("ssol-geodesics.dat");
EX tabled_inverses& get_tabled() {
switch(geom()) {
@ -642,7 +644,7 @@ EX namespace solnihv {
}
EX int approx_distance(heptagon *h1, heptagon *h2) {
auto m = (solnihv::hrmap_solnih*) currentmap;
auto m = (sn::hrmap_solnih*) currentmap;
dynamicval<eGeometry> g(geometry, gBinary4);
dynamicval<hrmap*> cm(currentmap, m->binary_map);
int d1 = bt::celldistance3_approx(m->coords[h1].first, m->coords[h2].first);
@ -1899,7 +1901,7 @@ EX namespace nisot {
EX hyperpoint christoffel(const hyperpoint at, const hyperpoint velocity, const hyperpoint transported) {
if(nil) return nilv::christoffel(at, velocity, transported);
#if CAP_SOLV
else if(solnih) return solnihv::christoffel(at, velocity, transported);
else if(sn::in()) return sn::christoffel(at, velocity, transported);
#endif
else if(sl2) return slr::christoffel(at, velocity, transported);
else return point3(0, 0, 0);
@ -1907,7 +1909,7 @@ EX namespace nisot {
EX bool in_table_range(hyperpoint h) {
#if CAP_SOLV
if(sol) return solnihv::in_table_range(h);
if(sol) return sn::in_table_range(h);
#endif
return true;
}
@ -1998,7 +2000,7 @@ EX namespace nisot {
EX hrmap *new_map() {
#if CAP_SOLV
if(solnih) return new solnihv::hrmap_solnih;
if(sn::in()) return new sn::hrmap_solnih;
#endif
if(nil) return new nilv::hrmap_nil;
if(prod) return new product::hrmap_product;
@ -2010,8 +2012,8 @@ EX namespace nisot {
using namespace arg;
#if CAP_SOLV
if(argis("-solrange")) {
shift_arg_formula(solnihv::solrange_xy);
shift_arg_formula(solnihv::solrange_z);
shift_arg_formula(sn::solrange_xy);
shift_arg_formula(sn::solrange_z);
return 0;
}
#endif
@ -2021,11 +2023,11 @@ EX namespace nisot {
}
#if CAP_SOLV
else if(argis("-fsol")) {
shift(); solnihv::solt.fname = args();
shift(); sn::solt.fname = args();
return 0;
}
else if(argis("-nihsol")) {
shift(); solnihv::niht.fname = args();
shift(); sn::niht.fname = args();
return 0;
}
#endif

View File

@ -792,7 +792,7 @@ void geometry_information::make_wall(int id, vector<hyperpoint> vertices, vector
h = zshift(normalize_flat(h), center_altitude * (1-x-y) + altitudes[a] * x + altitudes[b] * y);
hpcpush(h); return;
}
if(solnih || !bt::in()) { hpcpush(normalize(h)); return; }
if(sn::in() || !bt::in()) { hpcpush(normalize(h)); return; }
hyperpoint res = bt::parabolic3(h[0], h[1]) * xpush0(yy*h[2]);
hpcpush(res);
});
@ -810,7 +810,7 @@ void geometry_information::make_wall(int id, vector<hyperpoint> vertices, vector
}
if(nil)
h = nilv::on_geodesic(vertices[a], vertices[(a+1)%n], y * 1. / STEP);
if(solnih || !bt::in()) { hpcpush(normalize(h)); continue; }
if(sn::in() || !bt::in()) { hpcpush(normalize(h)); continue; }
hyperpoint res = bt::parabolic3(h[0], h[1]) * xpush0(yy*h[2]);
hpcpush(res);
}

View File

@ -308,7 +308,7 @@ void find_track(cell *start, int sign, int len) {
ld maxz = asonov::period_xy ? asonov::period_xy/3 : 1000000000;
id = int((log(z) / log(maxz)) * length);
}
else if(solnih)
else if(sn::in())
id = (start->master->distance - c1->master->distance) * sign;
else
id = trackval(c1);
@ -318,7 +318,7 @@ void find_track(cell *start, int sign, int len) {
if(use_exhaustive_distance) permanent_long_distances(goal);
if(solnih || nil || sl2) {
if(nonisotropic) {
vector<cell*> p;
while(goal != start) p.push_back(goal), goal = parent[goal];
while(!p.empty()) track.push_back(p.back()), p.pop_back();
@ -743,7 +743,7 @@ bool inrec = false;
EX ld race_angle = 90;
EX bool force_standard_centering() {
return solnih || nil || hybri || quotient || bounded;
return nonisotropic || hybri || quotient || bounded;
}
EX bool use_standard_centering() {
@ -1084,7 +1084,7 @@ void race_projection() {
add_thurston_race(XLAT("Euclidean"), [] { stop_game(); euc::clear_torus3(); set_geometry(gBitrunc3); });
add_thurston_race(XLAT("hyperbolic"), [] { set_geometry(gBinary3); vid.texture_step = 4; });
add_thurston_race(XLAT("spherical"), [] { set_geometry(gCell120); });
add_thurston_race(XLAT("Solv geometry"), [] { solnihv::solrange_xy = 10; solnihv::solrange_z = 3; set_geometry(gSol); });
add_thurston_race(XLAT("Solv geometry"), [] { sn::solrange_xy = 10; sn::solrange_z = 3; set_geometry(gSol); });
add_thurston_race(XLAT("S2xE"), [] { set_geometry(gSphere); set_variation(eVariation::bitruncated); set_geometry(gProduct); });
add_thurston_race(XLAT("H2xE"), [] { set_geometry(gNormal); set_variation(eVariation::bitruncated); set_geometry(gProduct); });
add_thurston_race(XLAT("Nil"), [] { stop_game(); nilv::nilperiod[0] = 0; set_geometry(gNil); });
@ -1092,8 +1092,8 @@ void race_projection() {
}
else {
add_thurston_race(XLAT("stretched hyperbolic"), [] { set_geometry(gNIH); vid.texture_step = 4; });
add_thurston_race(XLAT("stretched Solv"), [] { set_geometry(gSolN); solnihv::solrange_xy = 10; solnihv::solrange_z = 3; vid.texture_step = 4; });
add_thurston_race(XLAT("periodic Solv"), [] { stop_game(); solnihv::solrange_xy = 5; solnihv::solrange_z = 2; asonov::period_xy = 8; asonov::period_z = 0; asonov::set_flags(); set_geometry(gArnoldCat); });
add_thurston_race(XLAT("stretched Solv"), [] { set_geometry(gSolN); sn::solrange_xy = 10; sn::solrange_z = 3; vid.texture_step = 4; });
add_thurston_race(XLAT("periodic Solv"), [] { stop_game(); sn::solrange_xy = 5; sn::solrange_z = 2; asonov::period_xy = 8; asonov::period_z = 0; asonov::set_flags(); set_geometry(gArnoldCat); });
add_thurston_race(XLAT("hyperbolic crystal"), [] { set_geometry(gCrystal344); vid.texture_step = 4; });
add_thurston_race(XLAT("torus x E"), [] { stop_game(); euc::eu_input = euc::torus3(4, 4, 0); set_geometry(gCubeTiling); });
add_thurston_race(XLAT("hyperbolic regular"), [] { set_geometry(gSpace534); });

View File

@ -40,7 +40,7 @@ EX int max_cells = 2048;
EX bool rays_generate = true;
EX ld& exp_decay_current() {
return (solnih || hyperbolic) ? exp_decay_exp : exp_decay_poly;
return (sn::in() || hyperbolic) ? exp_decay_exp : exp_decay_poly;
}
EX int& max_iter_current() {
@ -49,7 +49,7 @@ EX int& max_iter_current() {
}
ld& maxstep_current() {
if(solnih) return maxstep_sol;
if(sn::in()) return maxstep_sol;
else return maxstep_nil;
}
@ -66,7 +66,7 @@ EX bool available() {
return true;
if(nil && S7 == 8)
return false;
if((solnih || nil) && pmodel == mdGeodesic)
if((sn::in() || nil) && pmodel == mdGeodesic)
return true;
if(euclid && pmodel == mdPerspective && !bt::in())
return true;
@ -436,7 +436,7 @@ void enable_raycaster() {
// " return vec4(0.,0.,0.,0.);\n"
" }\n";
if(solnih && !asonov) fsh += "uniform mediump float uBinaryWidth;\n";
if(sn::in() && !asonov) fsh += "uniform mediump float uBinaryWidth;\n";
fmain +=
" dist = next < minstep ? 2.*next : next;\n";
@ -457,7 +457,7 @@ void enable_raycaster() {
if(nil) fmain += "tangent = translate(position, itranslate(position, tangent));\n";
if(solnih) fmain +=
if(sn::in()) fmain +=
"vec4 acc = christoffel(position, tangent, tangent);\n"
"vec4 pos2 = position + tangent * dist / 2.;\n"
"vec4 tan2 = tangent + acc * dist / 2.;\n"
@ -526,7 +526,7 @@ void enable_raycaster() {
"}\n"
"else {\n";
if(solnih) {
if(sn::in()) {
if(asonov) fmain +=
"if(sp.x > 1.) which = 4;\n"
"if(sp.y > 1.) which = 5;\n"

View File

@ -158,7 +158,7 @@ shared_ptr<glhr::GLprogram> write_shader(flagtype shader_flags) {
else if(pmodel == mdGeodesic) {
shader_flags |= SF_PERS3 | SF_DIRECT;
coordinator += "t = inverse_exp(t);\n";
if(solnih) {
if(sn::in()) {
coordinator +=
"float d = sqrt(t[0] * t[0] + t[1] * t[1] + t[2] * t[2]);\n"
"float ad = (d == 0.) ? 0. : (d < 1.) ? min(atanh(d), 10.) : 10.;\n"
@ -170,18 +170,18 @@ shared_ptr<glhr::GLprogram> write_shader(flagtype shader_flags) {
switch(cgclass) {
#if CAP_SOLV
case gcSolNIH:
switch(solnihv::geom()) {
switch(sn::geom()) {
case gSol:
vsh += solnihv::shader_symsol;
vsh += sn::shader_symsol;
break;
case gNIH:
vsh += solnihv::shader_nsym;
vsh += sn::shader_nsym;
break;
case gSolN:
vsh += solnihv::shader_nsymsol;
vsh += sn::shader_nsymsol;
break;
default:
println(hlog, "error: unknown solnih geometry");
println(hlog, "error: unknown sn geometry");
}
treset = true;
break;
@ -320,7 +320,7 @@ void display_data::set_projection(int ed) {
#if CAP_SOLV
if(selected->uPRECX != -1) {
auto &tab = solnihv::get_tabled();
auto &tab = sn::get_tabled();
GLuint invexpid = tab.get_texture_id();