mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 09:50:34 +00:00
alternative honeycomb in Nil
This commit is contained in:
parent
2f353a844c
commit
bc2ce4f3dc
@ -928,6 +928,7 @@ EX void check_cgi() {
|
||||
if(prod) V("PS", its(product::csteps));
|
||||
|
||||
if(geometry == gFieldQuotient) { V("S3=", its(S3)); V("S7=", its(S7)); }
|
||||
if(nil) V("NIL", its(S7));
|
||||
|
||||
if(binarytiling) V("BT", fts(vid.binary_width));
|
||||
|
||||
|
@ -773,39 +773,47 @@ EX namespace nilv {
|
||||
hyperpoint mvec_to_point(mvec m) { return hpxy3(m[0], m[1], m[2]); }
|
||||
|
||||
#if HDR
|
||||
static const int nilv_S7 = 6;
|
||||
struct nilstructure {
|
||||
vector<mvec> movevectors;
|
||||
vector<vector<hyperpoint>> facevertices;
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
array<mvec, nilv_S7> movevectors = {{ 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) }};
|
||||
|
||||
EX array<vector<hyperpoint>, nilv_S7> facevertices = {{
|
||||
{ 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), },
|
||||
}};
|
||||
*/
|
||||
|
||||
array<mvec, nilv_S7> movevectors = {{ mvec(-1,0,0), mvec(0,-1,0), mvec(0,0,-1), mvec(1,0,0), mvec(0,1,0), mvec(0,0,1) }};
|
||||
nilstructure ns6 = {
|
||||
{{ mvec(-1,0,0), mvec(0,-1,0), mvec(0,0,-1), mvec(1,0,0), mvec(0,1,0), mvec(0,0,1) }},
|
||||
|
||||
EX array<vector<hyperpoint>, nilv_S7> facevertices = {{
|
||||
{{
|
||||
{ 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), },
|
||||
}};
|
||||
}}
|
||||
};
|
||||
|
||||
nilstructure ns8 = {
|
||||
{{ 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), },
|
||||
}}
|
||||
};
|
||||
|
||||
EX nilstructure& current_ns() { return S7 == 6 ? ns6 : ns8; }
|
||||
|
||||
EX array<int,3> nilperiod, nilperiod_edit;
|
||||
int S7_edit;
|
||||
|
||||
EX transmatrix adjmatrix(int i) {
|
||||
return nisot::translate(mvec_to_point(movevectors[i]));
|
||||
return nisot::translate(mvec_to_point(current_ns().movevectors[i]));
|
||||
}
|
||||
|
||||
struct hrmap_nil : hrmap {
|
||||
@ -835,10 +843,10 @@ EX namespace nilv {
|
||||
|
||||
heptagon *create_step(heptagon *parent, int d) override {
|
||||
auto p = coords[parent];
|
||||
auto q = p * movevectors[d];
|
||||
auto q = p * current_ns().movevectors[d];
|
||||
for(int a=0; a<3; a++) q[a] = zgmod(q[a], nilperiod[a]);
|
||||
auto child = get_at(q);
|
||||
parent->c.connect(d, child, (d + nilv_S7/2) % nilv_S7, false);
|
||||
parent->c.connect(d, child, (d + S7/2) % S7, false);
|
||||
return child;
|
||||
}
|
||||
|
||||
@ -921,6 +929,7 @@ EX color_t colorize(cell *c, char whichCanvas) {
|
||||
|
||||
EX void prepare_niltorus3() {
|
||||
nilperiod_edit = nilperiod;
|
||||
S7_edit = ginf[gNil].sides;
|
||||
}
|
||||
|
||||
EX void show_niltorus3() {
|
||||
@ -937,6 +946,8 @@ EX void show_niltorus3() {
|
||||
dialog::bound_low(0);
|
||||
});
|
||||
}
|
||||
dialog::addSelItem(XLAT("honeycomb"), its(S7_edit), 'h');
|
||||
dialog::add_action([] { S7_edit = S7_edit ^ 6 ^ 8; });
|
||||
|
||||
bool ok = (!nilperiod_edit[1]) || (nilperiod_edit[2] && nilperiod_edit[1] % nilperiod_edit[2] == 0);
|
||||
|
||||
@ -947,6 +958,7 @@ EX void show_niltorus3() {
|
||||
dialog::add_action([] {
|
||||
stop_game();
|
||||
nilperiod = nilperiod_edit;
|
||||
ginf[gNil].sides = S7_edit;
|
||||
set_flags();
|
||||
geometry = gNil;
|
||||
start_game();
|
||||
@ -1913,6 +1925,13 @@ EX namespace nisot {
|
||||
nilv::set_flags();
|
||||
return 0;
|
||||
}
|
||||
else if(argis("-nilv")) {
|
||||
PHASEFROM(2);
|
||||
if(nil) stop_game();
|
||||
shift();
|
||||
ginf[gNil].sides = argi();
|
||||
return 0;
|
||||
}
|
||||
else if(argis("-catperiod")) {
|
||||
PHASEFROM(2);
|
||||
if(sol) stop_game();
|
||||
|
@ -1078,7 +1078,7 @@ void geometry_information::create_wall3d() {
|
||||
}
|
||||
|
||||
if(geometry == gNil) {
|
||||
for(int i=0; i<S7; i++) make_wall(i, nilv::facevertices[i]);
|
||||
for(int i=0; i<S7; i++) make_wall(i, nilv::current_ns().facevertices[i]);
|
||||
}
|
||||
|
||||
if(penrose) {
|
||||
|
@ -64,6 +64,8 @@ EX bool available() {
|
||||
if(WDIM == 2) return false;
|
||||
if(hyperbolic && pmodel == mdPerspective && !penrose)
|
||||
return true;
|
||||
if(nil && S7 == 8)
|
||||
return false;
|
||||
if((solnih || nil) && pmodel == mdGeodesic)
|
||||
return true;
|
||||
if(euclid && pmodel == mdPerspective && !binarytiling)
|
||||
|
Loading…
Reference in New Issue
Block a user