mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
hat:: hat parameter
This commit is contained in:
parent
56ca00df82
commit
defeaf2cc6
@ -382,6 +382,8 @@ vector<rule_recursive> rules_recursive = {
|
|||||||
{6, 6, 31, 31, 14},
|
{6, 6, 31, 31, 14},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EX ld hat_param = 1;
|
||||||
|
|
||||||
struct hrmap_hat : hrmap {
|
struct hrmap_hat : hrmap {
|
||||||
|
|
||||||
// always generate the same way
|
// always generate the same way
|
||||||
@ -402,17 +404,18 @@ struct hrmap_hat : hrmap {
|
|||||||
void init() {
|
void init() {
|
||||||
|
|
||||||
transmatrix T = Id;
|
transmatrix T = Id;
|
||||||
hatcorners[0].clear();
|
auto& hc = hatcorners[0];
|
||||||
|
hc.clear();
|
||||||
hatcorners[1].clear();
|
hatcorners[1].clear();
|
||||||
|
|
||||||
auto move = [&] (ld angle, ld dist) {
|
auto move = [&] (ld angle, ld dist) {
|
||||||
hatcorners[0].push_back(T * C0);
|
hc.push_back(T * C0);
|
||||||
T = T * spin(angle * degree);
|
T = T * spin(angle * degree);
|
||||||
T = T * xpush(dist);
|
T = T * xpush(dist);
|
||||||
};
|
};
|
||||||
|
|
||||||
ld q = 6;
|
ld q = 6;
|
||||||
ld eshort = 0.5;
|
ld eshort = 0.3;
|
||||||
ld elong = sqrt(3) * eshort;
|
ld elong = sqrt(3) * eshort;
|
||||||
if(fake::in()) q = fake::around;
|
if(fake::in()) q = fake::around;
|
||||||
|
|
||||||
@ -420,6 +423,13 @@ struct hrmap_hat : hrmap {
|
|||||||
eshort = edge_of_triangle_with_angles(M_PI / q, 60._deg, 90._deg);
|
eshort = edge_of_triangle_with_angles(M_PI / q, 60._deg, 90._deg);
|
||||||
elong = edge_of_triangle_with_angles(60._deg, M_PI / q, 90._deg);
|
elong = edge_of_triangle_with_angles(60._deg, M_PI / q, 90._deg);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
eshort *= hat_param;
|
||||||
|
elong *= 2 - hat_param;
|
||||||
|
// 0-length edges cause problems...
|
||||||
|
if(eshort == 0) eshort = .0001;
|
||||||
|
if(elong == 0) elong = .0001;
|
||||||
|
}
|
||||||
|
|
||||||
ld i60 = (M_PI - TAU*2/q)/degree;
|
ld i60 = (M_PI - TAU*2/q)/degree;
|
||||||
ld n60 = (M_PI - TAU*4/q)/degree;
|
ld n60 = (M_PI - TAU*4/q)/degree;
|
||||||
@ -430,13 +440,22 @@ struct hrmap_hat : hrmap {
|
|||||||
move(i60, elong); move(-90, eshort); move( 60, eshort);
|
move(i60, elong); move(-90, eshort); move( 60, eshort);
|
||||||
move( 90, elong); move(i60, elong);
|
move( 90, elong); move(i60, elong);
|
||||||
|
|
||||||
hyperpoint ctr = Hypc;
|
if(q == 6) {
|
||||||
for(auto h: hatcorners[0]) ctr += h;
|
ld area = 0;
|
||||||
ctr /= isize(hatcorners[0]);
|
for(int i=0; i<14; i++) area += (hc[(i+1)%14] ^ hc[i]) [2];
|
||||||
ctr = normalize(ctr);
|
println(hlog, "area = ", area);
|
||||||
for(auto& h: hatcorners[0]) h = gpushxto0(ctr) * h;
|
area = abs(area);
|
||||||
|
ld scale = sqrt(2.5 / area);
|
||||||
|
for(auto& h: hc) h = h * scale + (C0) * (1-scale);
|
||||||
|
}
|
||||||
|
|
||||||
hatcorners[1] = hatcorners[0];
|
hyperpoint ctr = Hypc;
|
||||||
|
for(auto h: hc) ctr += h;
|
||||||
|
ctr /= isize(hc);
|
||||||
|
ctr = normalize(ctr);
|
||||||
|
for(auto& h: hc) h = gpushxto0(ctr) * h;
|
||||||
|
|
||||||
|
hatcorners[1] = hc;
|
||||||
for(auto& h: hatcorners[1]) h = MirrorX * h;
|
for(auto& h: hatcorners[1]) h = MirrorX * h;
|
||||||
reverse(hatcorners[1].begin(), hatcorners[1].end());
|
reverse(hatcorners[1].begin(), hatcorners[1].end());
|
||||||
}
|
}
|
||||||
@ -608,6 +627,7 @@ EX int get_hat_id(cell *c) {
|
|||||||
EX void reshape() {
|
EX void reshape() {
|
||||||
hrmap_hat *hatmap;
|
hrmap_hat *hatmap;
|
||||||
hatmap = FPIU( hat_map() );
|
hatmap = FPIU( hat_map() );
|
||||||
|
if(!hatmap) return;
|
||||||
hatmap->init();
|
hatmap->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,7 +822,14 @@ EX void initConfig() {
|
|||||||
|
|
||||||
param_f(vid.binary_width, "bwidth", "binary-tiling-width", 1);
|
param_f(vid.binary_width, "bwidth", "binary-tiling-width", 1);
|
||||||
param_custom(vid.binary_width, "binary tiling width", menuitem_binary_width, 'v');
|
param_custom(vid.binary_width, "binary tiling width", menuitem_binary_width, 'v');
|
||||||
|
|
||||||
|
param_f(hat::hat_param, "hat_param", "hat_param", 1)
|
||||||
|
-> editable(0, 2, 1, "Hat parameter",
|
||||||
|
"Apeirodic hat tiling based on: https://arxiv.org/pdf/2303.10798.pdf\n\n"
|
||||||
|
"This controls the parameter discussed in Section 6.", 'v'
|
||||||
|
)
|
||||||
|
-> set_reaction(hat::reshape);
|
||||||
|
|
||||||
addsaver(vid.particles, "extra effects", 1);
|
addsaver(vid.particles, "extra effects", 1);
|
||||||
param_i(vid.framelimit, "frame limit", 999);
|
param_i(vid.framelimit, "frame limit", 999);
|
||||||
|
|
||||||
|
@ -1022,6 +1022,9 @@ EX void showEuclideanMenu() {
|
|||||||
menuitem_binary_width('v');
|
menuitem_binary_width('v');
|
||||||
add_edit_wall_quality('W');
|
add_edit_wall_quality('W');
|
||||||
}
|
}
|
||||||
|
else if(hat::in()) {
|
||||||
|
add_edit(hat::hat_param);
|
||||||
|
}
|
||||||
else if(nil) {
|
else if(nil) {
|
||||||
menuitem_nilwidth('v');
|
menuitem_nilwidth('v');
|
||||||
}
|
}
|
||||||
|
@ -720,7 +720,6 @@ void geometry_information::prepare_basics() {
|
|||||||
#if CAP_BT
|
#if CAP_BT
|
||||||
if(bt::in()) hexvdist = rhexf = 1, tessf = 1, scalefactor = 1, crossf = hcrossf7;
|
if(bt::in()) hexvdist = rhexf = 1, tessf = 1, scalefactor = 1, crossf = hcrossf7;
|
||||||
if(geometry == gHoroRec || kite::in() || sol || nil || nih) hexvdist = rhexf = .5, tessf = .5, scalefactor = .5, crossf = hcrossf7/2;
|
if(geometry == gHoroRec || kite::in() || sol || nil || nih) hexvdist = rhexf = .5, tessf = .5, scalefactor = .5, crossf = hcrossf7/2;
|
||||||
if(hat::in()) scalefactor *= 1.5, crossf *= 1.5, tessf *= 1.5, hexvdist *= 1.5, rhexf *= 1.5;
|
|
||||||
if(bt::in()) scalefactor *= min<ld>(vid.binary_width, 1), crossf *= min<ld>(vid.binary_width, 1);
|
if(bt::in()) scalefactor *= min<ld>(vid.binary_width, 1), crossf *= min<ld>(vid.binary_width, 1);
|
||||||
#endif
|
#endif
|
||||||
#if MAXMDIM >= 4
|
#if MAXMDIM >= 4
|
||||||
@ -1262,6 +1261,7 @@ EX string cgi_string() {
|
|||||||
if(nil) V("NIL", its(S7));
|
if(nil) V("NIL", its(S7));
|
||||||
|
|
||||||
if(bt::in()) V("BT", fts(vid.binary_width));
|
if(bt::in()) V("BT", fts(vid.binary_width));
|
||||||
|
if(hat::in()) V("H", fts(hat::hat_param));
|
||||||
|
|
||||||
if(nil) V("NILW", fts(nilv::nilwidth));
|
if(nil) V("NILW", fts(nilv::nilwidth));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user