![]() |
HyperRogue
11.3d
game/visualization engine based on non-Euclidean geometry
|
various functions computing the standings of individual cells with respect to various patterns More...
#include "hyper.h"
Classes | |
struct | hr::patterns::patterninfo |
struct | hr::patterns::changeable_pattern_geometry |
struct | hr::patterns::changeable_pattern |
struct | hr::linepatterns::linepattern |
Namespaces | |
hr | |
Variables | |
int | hr::elhextable [28][3] |
EX ePattern | hr::patterns::whichPattern = PAT_NONE |
EX int | hr::patterns::subpattern_flags |
EX map< char, colortable > | hr::colortables |
EX int | hr::patterns::canvasback = linf[laCanvas].color >> 2 |
EX int | hr::patterns::subcanvas |
EX bool | hr::patterns::displaycodes |
EX char | hr::patterns::whichShape = 0 |
EX char | hr::patterns::whichCanvas = 0 |
EX bool | hr::patterns::innerwalls |
EX string | hr::patterns::color_formula = "to01(rgb(x,y,z))" |
map< cell *, color_t > | hr::patterns::computed_nearer_map |
map< cell *, color_t > | hr::patterns::computed_furthest_map |
EX hookset< int(cell *)> * | hr::patterns::hooks_generate_canvas |
vector< changeable_pattern > | hr::patterns::cpatterns |
EX cpatterntype | hr::patterns::cgroup |
EX cpatterntype | hr::patterns::old_cgroup |
linepattern | hr::linepatterns::patDual ("dual grid", 0xFFFFFF00, always_available, ALLCELLS(forCellIdEx(c2, i, c) if(c2 > c) { gridlinef(V, C0, V *currentmap->adj(c, i), C0, col, 2+vid.linequality);})) |
linepattern | hr::linepatterns::patHepta ("heptagonal grid", 0x0000C000, always_available, ALLCELLS(forCellIdEx(c2, i, c) if(c2 > c) if(pseudohept(c)==pseudohept(c2)) gridlinef(V, C0, V *currentmap->adj(c, i), C0, col, 2+vid.linequality);)) |
linepattern | hr::linepatterns::patRhomb ("rhombic tesselation", 0x0000C000, always_available, ALLCELLS(forCellIdEx(c2, i, c) if(c2 > c) if(pseudohept(c) !=pseudohept(c2)) gridlinef(V, C0, V *currentmap->adj(c, i), C0, col, 2+vid.linequality);)) |
linepattern | hr::linepatterns::patTrihepta ("triheptagonal tesselation", 0x0000C000, always_available, ALLCELLS(if(pseudohept(c)) for(int t=0;t< c->type;t++) gridline(V, get_warp_corner(c, t%c->type), get_warp_corner(c,(t+1)%c->type), col, 1+vid.linequality);)) |
linepattern | hr::linepatterns::patNormal ("normal tesselation", 0x0000C000, always_available, ALLCELLS(for(int t=0;t< c->type;t++) if(c->move(t) &&c->move(t)< c) gridline(V, get_corner_position(c, t), get_corner_position(c,(t+1)%c->type), col, 1+vid.linequality);)) |
linepattern | hr::linepatterns::patBigTriangles ("big triangular grid", 0x00606000, always_available, ALLCELLS(if(is_master(c) &&!euclid) for(int i=0;i< S7;i++) if(c->master->move(i) &&c->master->move(i)< c->master) { gridlinef(V, C0, xspinpush0(-2 *M_PI *i/S7 - master_to_c7_angle(), cgi.tessf), col, 2+vid.linequality);})) |
linepattern | hr::linepatterns::patBigRings ("big triangles: rings", 0x00606000, cheating, ALLCELLS(if(is_master(c) &&!euclid) for(int i=0;i< S7;i++) if(c->master->move(i) &&c->master->move(i)< c->master &&c->master->move(i) ->dm4==c->master->dm4) gridlinef(V, C0, xspinpush0(-2 *M_PI *i/S7 - master_to_c7_angle(), cgi.tessf), col, 2+vid.linequality);)) |
linepattern | hr::linepatterns::patTree ("underlying tree", 0x00d0d000, cheating, ALLCELLS(if(is_master(c)) { int dir=updir(c->master);if(dir==-1) continue;cell *c2=c->master->move(dir) ->c7;if(gmatrix.count(c2)) { if(S3 >=OINF) gridlinef(V, C0, Id, mid(tC0(V), tC0(V *currentmap->adj(c, dir))), col, 2+vid.linequality);else gridlinef(V, C0, V *master_relative(c, true) *currentmap->adj(c->master, dir), C0, col, 2+vid.linequality);} })) |
linepattern | hr::linepatterns::patAltTree ("circle/horocycle tree", 0xd000d000, cheating, ALLCELLS(if(is_master(c)) { int dir=updir_alt(c->master);if(dir==-1) continue;for(int i=0;i< S7;i++) if(c->master->move(i) &&c->master->move(i) ->alt==c->master->alt->move(0)) { cell *c2=c->master->move(i) ->c7;if(gmatrix.count(c2)) { if(S3 >=OINF) { gridlinef(V, C0, Id, mid(tC0(V), tC0(gmatrix[c2])), col, 2+vid.linequality);} else gridlinef(V, C0, V *master_relative(c, true) *currentmap->adj(c->master, i), C0, col, 2+vid.linequality);} } })) |
linepattern | hr::linepatterns::patHeawood ("seven-colorable torus", 0x40FF4000, [] { return euc::in(2, 6);}, ALLCELLS(if(c !=c->master->c7||patterns::sevenval(c)) break;gridline(V, C0, tC0(euc::eumove(gp::loc(-1,+3))), col, 3+vid.linequality);gridline(V, C0, tC0(euc::eumove(gp::loc(-3,+2))), col, 3+vid.linequality);gridline(V, C0, tC0(euc::eumove(gp::loc(-2, -1))), col, 3+vid.linequality);gridline(V, C0, tC0(euc::eumove(gp::loc(+1, -3))), col, 3+vid.linequality);gridline(V, C0, tC0(euc::eumove(gp::loc(+3, -2))), col, 3+vid.linequality);gridline(V, C0, tC0(euc::eumove(gp::loc(+2,+1))), col, 3+vid.linequality);)) |
linepattern | hr::linepatterns::patZebraTriangles ("zebra triangles", 0x40FF4000, stdhyp_only, ALLCELLS(if(zebra40(c)/4==10) { bool all=true;transmatrix tri[3];for(int i=0;i< 3;i++) tri[i]=V *currentmap->adj(c, i *2);if(all) for(int i=0;i< 3;i++) gridline(tri[i], C0, tri[(i+1)%3], C0, col, 3+vid.linequality);})) |
linepattern | hr::linepatterns::patZebraLines ("zebra lines", 0xFF000000, stdhyp_only, ALLCELLS(if(!pseudohept(c)) for(int i=0;i< c->type;i+=2) { cell *c2=createMov(c, i);int fv1=zebra40(c);if(fv1/4==4||fv1/4==6||fv1/4==5||fv1/4==10) fv1 ^=2;int fv2=zebra40(c2);if(fv2/4==4||fv2/4==6||fv2/4==5||fv2/4==10) fv2 ^=2;if((fv1 &1)==(fv2 &1)) continue;double x=cgi.hexhexdist/2;gridlinef(V, ddspin(c, i,-M_PI/S3) *xpush0(x), ddspin(c, i, M_PI/S3) *xpush0(x), col, 1+vid.linequality);})) |
linepattern | hr::linepatterns::patGoldbergTree ("Goldberg tree", 0x8438A400, [] { return GOLDBERG;}, ALLCELLS(if(c->master->c7 !=c) gridlinef(V, C0, V *currentmap->adj(c, 0), C0, darkena(backcolor ^ 0xFFFFFF, 0, col), 2+vid.linequality);)) |
linepattern | hr::linepatterns::patIrregularMaster ("irregular master", 0x8438A400, [] { return IRREGULAR;}, ALLCELLS(if(c->master->c7 !=c) if(gmatrix.count(c->master->c7)) gridlinef(V, C0, V *master_relative(c, true), C0, darkena(backcolor ^ 0xFFFFFF, 0, col), 2+vid.linequality);)) |
linepattern | hr::linepatterns::patVine ("vineyard pattern", 0x8438A400, stdhyp_only, ALLCELLS(int p=emeraldval(c);double hdist=hdist0(cgi.heptmove[0] *cgi.heptmove[2] *C0);if(pseudohept(c) &&(p/4==10||p/4==8)) for(int i=0;i< S7;i++) if(c->move(i) &&emeraldval(c->move(i))==p-4) { gridlinef(V, C0, tC0(cgi.heptmove[i]), col, 2+vid.linequality);gridlinef(V, C0, xspinpush0(-i *2 *M_PI/S7, -hdist/2), col, 2+vid.linequality);})) |
linepattern | hr::linepatterns::patPalacelike ("firewall lines", 0xFF400000, stdhyp_only, ALLCELLS(if(pseudohept(c)) for(int i=0;i< 7;i++) gridlinef(V, ddspin(c, i, M_PI *5/7) *xpush0(cgi.tessf/2), ddspin(c, i, M_PI *9/7) *xpush0(cgi.tessf/2), col, 1+vid.linequality);)) |
linepattern | hr::linepatterns::patPalace ("firewall lines: Palace", 0xFFD50000, stdhyp_only, ALLCELLS(bool a=polarb50(c);if(pseudohept(c)) for(int i=0;i< 7;i++) { cell *c1=createMov(c,(i+3) % 7);cell *c2=createMov(c,(i+4) % 7);if(polarb50(c1) !=a &&polarb50(c2) !=a) gridlinef(V, ddspin(c, i, M_PI *5/7) *xpush0(cgi.tessf/2), ddspin(c, i, M_PI *9/7) *xpush0(cgi.tessf/2), col, 1+vid.linequality);})) |
linepattern | hr::linepatterns::patGoldbergSep ("Goldberg", 0xFFFF0000, [] { return GOLDBERG;}, ALLCELLS(forCellIdEx(c2, i, c) if(c2->master !=c->master) gridlinef(V, C0, V *currentmap->adj(c, i), C0, col, 1+vid.linequality);)) |
linepattern | hr::linepatterns::patArcm ("Archimedean", 0xFFFF0000, [] { return arcm::in();}, ALLCELLS(if(!pseudohept(c)) forCellIdEx(c2, i, c) if(c< c2 &&!pseudohept(c2)) gridlinef(V, C0, V *currentmap->adj(c, i), C0, col, 1+vid.linequality);)) |
linepattern | hr::linepatterns::patPower ("firewall lines: Power", 0xFFFF0000, stdhyp_only, ALLCELLS(int a=emeraldval(c);if(pseudohept(c) &&a/4==8) for(int i=0;i< 7;i++) { heptagon *h1=c->master->modmove(i+1);heptagon *h2=c->master->modmove(i-1);if(!h1||!h2) continue;if(emeraldval(h1->c7)/4==8 &&emeraldval(h2->c7)/4==8) gridlinef(V, ddspin(c, i, M_PI *5/7) *xpush0(cgi.tessf/2), ddspin(c, i, M_PI *9/7) *xpush0(cgi.tessf/2), col, 1+vid.linequality);})) |
linepattern | hr::linepatterns::patHorocycles ("horocycles", 0xd060d000, cheating, ALLCELLS(if(c->master->alt) { int d=celldistAlt(c);forCellIdEx(c2, i, c) if(c2 > c &&c2->master->alt &&celldistAlt(c2)==d) gridlinef(V, C0, V *currentmap->adj(c, i), C0, darkena(backcolor ^ 0xFFFFFF, 0, col), 2+vid.linequality);})) |
linepattern | hr::linepatterns::patTriRings ("triangle grid: rings", 0xFFFFFF00, always_available, ALLCELLS(forCellIdEx(c2, i, c) { if(S3==4) c2=(cellwalker(c, i)+wstep+1).cpeek();if(c2 > c) if(curr_dist(c)==curr_dist(c2)) gridlinef(V, C0, V *currentmap->adj(c, i), C0, col, 2+vid.linequality);})) |
linepattern | hr::linepatterns::patTriTree ("triangle grid: tree edges", 0xFFFFFF00, always_available, ALLCELLS(cell *parent=ts::right_parent(c, curr_dist);if(gmatrix.count(parent)) gridlinef(V, C0, V *currentmap->adj(c, neighborId(c, parent)), C0, col, 2+vid.linequality);)) |
linepattern | hr::linepatterns::patTriOther ("triangle grid: other edges", 0xFFFFFF00, always_available, ALLCELLS(cell *parent=ts::right_parent(c, curr_dist);forCellIdEx(c2, i, c) if(curr_dist(c2)< curr_dist(c) &&c2 !=parent) gridlinef(V, C0, V *currentmap->adj(c, i), C0, col, 2+vid.linequality);)) |
linepattern | hr::linepatterns::patCircles ("circles", 0xFFFFFF00, always_available, ATCENTER(for(int i=15;i<=180;i+=15) { for(int j=0;j< 360;j+=15) { for(int k=0;k<=15;k++) curvepoint(xspinpush0((j+k) *degree, i *degree));queuecurve(col, 0, PPR::LINE).V=V;} })) |
linepattern | hr::linepatterns::patRadii ("radii", 0xFFFFFF00, always_available, ATCENTER(for(int i=0;i< 360;i+=15) { for(int j=0;j< 180;j+=15) { for(int k=0;k<=15;k++) curvepoint(xspinpush0(i *degree,(j+k) *degree));queuecurve(col, 0, PPR::LINE).V=V;} })) |
linepattern | hr::linepatterns::patMeridians ("meridians", 0xFFFFFF00, always_available, ATCENTER(for(int j=-180;j<=180;j+=15) { for(int i=-90;i< 90;i+=15) { for(int k=0;k<=15;k++) curvepoint(V *xpush(j *degree) *ypush0((i+k) *degree));queuecurve(col, 0, PPR::LINE).V=V;} })) |
linepattern | hr::linepatterns::patParallels ("parallels", 0xFFFFFF00, always_available, ATCENTER(for(int i=-90;i<=90;i+=15) { for(int j=-180;j< 180;j+=15) { for(int k=0;k<=15;k++) curvepoint(V *xpush((j+k) *degree) *ypush0(i *degree));queuecurve(col, 0, PPR::LINE).V=V;} })) |
linepattern | hr::linepatterns::patSublines ("sub-lines", 0xFFFFFF00, arb::in, ALLCELLS(int i=arb::id_of(c->master);auto &sh=arb::current.shapes[i];for(auto p:sh.sublines) gridlinef(V, sh.vertices[p.first], sh.vertices[p.second], col, 2+vid.linequality);)) |
EX vector< linepattern * > | hr::linepatterns::patterns |
EX ld | hr::linepatterns::width = 1 |
int | hr::linepatterns::numpat = 0 |
bool | hr::linepatterns::indiv |
auto | hr::ah_pattern = addHook(hooks_args, 0, read_pattern_args) + addHook(clearmemory, 100, [] { patterns::computed_nearer_map.clear(); patterns::computed_furthest_map.clear(); }) |
various functions computing the standings of individual cells with respect to various patterns
Patterns include simple ones (hexagon or heptagon, three-colorings, Chessboard) as well as more complex ones (Emerald, Palace, Field Pattern)
EX vector<linepattern*> hr::linepatterns::patterns |