inforder basics

This commit is contained in:
Zeno Rogue 2019-10-10 13:08:06 +02:00
parent e799f76e5d
commit b5f6e6f3f5
10 changed files with 66 additions and 5 deletions

View File

@ -257,6 +257,7 @@ EX void initcells() {
#if CAP_BT
else if(binarytiling) currentmap = binary::new_map();
#endif
else if(S3 >= OINF) currentmap = inforder::new_map();
else currentmap = new hrmap_hyperbolic;
allmaps.push_back(currentmap);
@ -1034,6 +1035,8 @@ EX int celldistance(cell *c1, cell *c2) {
return DISTANCE_UNKNOWN;
}
if(S3 >= OINF) return inforder::celldistance(c1, c2);
#if CAP_BT && MAXMDIM >= 4
if(binarytiling && WDIM == 3)

View File

@ -590,8 +590,8 @@ vector<geometryinfo> ginf = {
{"ternary","none", "standard ternary tiling", "ternary", 6, 3, qBINARY, giHyperb2, 0x48400, {{6, 4}}, eVariation::pure},
{"3x2", "none", "stretched hyperbolic", "3:2", 11, 3, qBINARY|qNIH, giSolNIH, 0x49000, {{6, 3}}, eVariation::pure},
{"3x1/2", "none", "stretched Solv", "3:1/2", 9, 3, (qBINARY|qSOL|qNIH), giSolNIH, 0x49200, {{7, 3}}, eVariation::pure},
{"{3,oo}", "none", "{3,∞} (infinite triangles)", "oox3", 3, 100, qIDEAL, giHyperb2, 0x49400, {{7, 7}}, eVariation::pure},
};
// bits: 9, 10, 15, 16, (reserved for later) 17, 18
// remember to match the following mask when specifying codes for extra geometries: 0x78600

View File

@ -215,7 +215,7 @@ enum eGeometry {
gField435, gField534,
gBinary4, gSol,
gKiteDart2, gKiteDart3, gNil, gProduct, gRotSpace,
gTernary, gNIH, gSolN,
gTernary, gNIH, gSolN, gInfOrder,
gGUARD};
enum eGeometryClass { gcHyperbolic, gcEuclid, gcSphere, gcSolNIH, gcNil, gcProduct, gcSL2 };
@ -274,6 +274,8 @@ static const flagtype qSOL = 16384;
static const flagtype qEXPERIMENTAL = 32768;
static const flagtype qNIH = 65536;
static const flagtype qIDEAL = 131072;
// note: dnext assumes that x&7 equals 7
static const int SEE_ALL = 50;
static const int FORBIDDEN = -1;
@ -352,4 +354,6 @@ struct modelinfo {
extern std::vector<modelinfo> mdinf;
static const int OINF = 100;
}

View File

@ -484,7 +484,7 @@ void geometry_information::prepare_basics() {
goto finish;
}
tessf = edge_of_triangle_with_angles(2*M_PI/S3, M_PI/S7, M_PI/S7);
tessf = edge_of_triangle_with_angles(S3 >= OINF ? 0 : 2*M_PI/S3, M_PI/S7, M_PI/S7);
if(elliptic && S7 == 4) tessf = M_PI/2;

View File

@ -52,6 +52,10 @@ EX hstate transition(hstate s, int dir) {
if(s == hsB && (dir >= 2 && dir < S7-2)) return hsA;
if(s == hsB && (dir == S7-2)) return hsB;
}
else if(S3 >= OINF) {
if(s == hsOrigin) return hsA;
if(s == hsA && dir) return hsA;
}
else {
if(s == hsOrigin) return hsA;
if(s == hsA && dir >= 3 && dir <= S7-3) return hsA;

View File

@ -100,6 +100,7 @@
#include "commandline.cpp"
#include "bigstuff.cpp"
#include "multigame.cpp"
#include "inforder.cpp"
#if CAP_ROGUEVIZ
#include "rogueviz/rogueviz.cpp"

48
inforder.cpp Normal file
View File

@ -0,0 +1,48 @@
// Hyperbolic Rogue -- infinite-order tessellations
// Copyright (C) 2011-2019 Zeno Rogue, see 'hyper.cpp' for details
/** \file inforder3.cpp
* \brief infinite-order tessellations
*
* very simple
*/
#include "hyper.h"
namespace hr {
EX namespace inforder {
struct hrmap_inforder : hrmap_hyperbolic {
heptagon *create_step(heptagon *h, int direction) {
auto h1 = tailored_alloc<heptagon> (S7);
bool par = h->s == hsA && direction == 0;
h->c.connect(direction, h1, par ? 1 + hrand(2) : 0, false);
h1->alt = NULL;
h1->s = hsA;
h1->cdata = NULL;
h1->distance = h->distance + (par ? -1 : 1);
h1->c7 = newCell(S7, h1);
return h1;
}
};
EX hrmap* new_map() { return new hrmap_inforder; }
EX int celldistance(cell *c1, cell *c2) {
int d = 0;
while(true) {
if(c1 == c2) return d;
else if(c1->master->distance >= c2->master->distance) c1 = c1->move(0), d++;
else c2 = c2->move(0), d++;
}
}
EX }
}

View File

@ -397,7 +397,7 @@ EX int fieldval_uniq(cell *c) {
auto p = cell_to_pair(c);
return gmod(p.first * torusconfig::dx + p.second * torusconfig::dy, torusconfig::qty);
}
else if(binarytiling || archimedean || nil) return 0;
else if(binarytiling || archimedean || nil || S3 >= OINF) return 0;
else if(&currfp == &fp_invalid) return 0;
else if(WDIM == 3) return c->master->fieldval;
else if(ctof(c) || NONSTDVAR) return c->master->fieldval/S7;

View File

@ -20,7 +20,7 @@ void geometry_information::hpcpush(hyperpoint h) {
ld threshold = (GDIM == 3 || last->flags & POLY_TRIANGLES) ? 100 : (sphere ? (ISMOBWEB || NONSTDVAR ? .04 : .001) : 0.1) * pow(.25, vid.linequality);
if(/*vid.usingGL && */!first) {
ld i = intval(hpc.back(), h);
if(i > threshold && i < 10) {
if(i > threshold && (i < 10 || S3 >= OINF)) {
hyperpoint md = mid(hpc.back(), h);
hpcpush(md);
hpcpush(h);

View File

@ -1216,6 +1216,7 @@ EX void set_geometry(eGeometry target) {
#if CAP_BT
if(binarytiling || WDIM == 3 || penrose) if(!hybri) variation = eVariation::pure;
#endif
if(S3 == OINF) variation = eVariation::pure;
if(was_default) pmodel = default_model();
if(nonisotropic && old_DIM == 2 && vid.texture_step < 4) vid.texture_step = 4;
if(prod) { pmodel = mdPerspective; if(vid.texture_step < 4) vid.texture_step = 4; }