introduced rulegen.cpp which generates strict_tree_rules for arb

This commit is contained in:
Zeno Rogue 2021-07-29 14:07:30 +02:00
parent bb3fbc5256
commit c53270ca16
7 changed files with 1594 additions and 7 deletions

View File

@ -140,6 +140,7 @@ EX bool grailWasFound(cell *c) {
}
EX int default_levs() {
if(arb::in()) return 2;
if(IRREGULAR)
return 1;
if(S3 >= OINF)
@ -1376,7 +1377,7 @@ EX int wallchance(cell *c, bool deepOcean) {
/** \brief should we generate the horocycles in the current geometry? */
EX bool horo_ok() {
if(INVERSE) return false;
if(currentmap->strict_tree_rules()) return false;
if(currentmap->strict_tree_rules()) return true;
return hyperbolic && !bt::in() && !arcm::in() && !kite::in() && !experimental && !hybri && !arb::in() && !quotient;
}
@ -1931,7 +1932,6 @@ EX void gen_temple(cell *c) {
}
EX void moreBigStuff(cell *c) {
if(currentmap->strict_tree_rules()) return;
if((bearsCamelot(c->land) && !euclid && !quotient && !nil) || c->land == laCamelot)
if(have_alt(c)) if(!(bt::in() && specialland != laCamelot))

View File

@ -231,6 +231,8 @@ EX hrmap *newAltMap(heptagon *o) {
if(reg3::in_rule())
return reg3::new_alt_map(o);
#endif
if(currentmap->strict_tree_rules())
return rulegen::new_hrmap_rulegen_alt(o);
return new hrmap_hyperbolic(o);
}
// --- hyperbolic geometry ---

View File

@ -99,12 +99,20 @@ template<class T, class U> vector<int> get_children_codes(cell *c, const T& dist
}
return res;
}
void expansion_analyzer::preliminary_grouping() {
samples.clear();
codeid.clear();
children.clear();
if(reg3::in_rule()) {
children.clear();
if(currentmap->strict_tree_rules()) {
N = isize(rulegen::treestates);
children.resize(N);
rootid = rulegen::rule_root;
for(int i=0; i<N; i++)
for(int v: rulegen::treestates[i].rules)
if(v >= 0) children[i].push_back(v);
}
else if(reg3::in_rule()) {
#if MAXMDIM >= 4
rootid = reg3::rule_get_root(0);
auto& chi = reg3::rule_get_children();
@ -387,6 +395,8 @@ EX bool sizes_known() {
// not implemented
if(arcm::in()) return false;
if(kite::in()) return false;
if(currentmap->strict_tree_rules()) return true;
if(arb::in()) return false;
return true;
}
@ -442,6 +452,8 @@ EX int curr_dist(cell *c) {
int position;
EX int type_in_reduced(expansion_analyzer& ea, cell *c, const cellfunction& f) {
if(currentmap->strict_tree_rules())
return rulegen::get_state(c);
int a = ea.N;
int t = type_in(ea, c, f);
if(expansion.N != a) {
@ -703,7 +715,7 @@ void expansion_analyzer::view_distances_dialog() {
if(really_use_analyzer) {
int t;
if(reg3::in_rule()) {
if(reg3::in_rule() || currentmap->strict_tree_rules()) {
if(!N) preliminary_grouping();
t = rootid;
}
@ -743,7 +755,7 @@ void expansion_analyzer::view_distances_dialog() {
dialog::addBreak(100 * scrolltime / scrollspeed);
if(sizes_known() || bt::in()) {
if(euclid) {
if(euclid && !arb::in()) {
dialog::addBreak(200);
dialog::addInfo("a(d) = " + its(get_descendants(10).approx_int() - get_descendants(9).approx_int()) + "d", forecolor);
}

View File

@ -777,6 +777,7 @@ void geometry_information::generate_floorshapes() {
for(int i=0; i<n; i++) {
auto &ms = models[i];
auto &mh = modelh[i];
mh.fieldval = -1;
for(auto& t: ms.c.move_table) t = nullptr;
for(auto& t: mh.c.move_table) t = nullptr;
}

View File

@ -3535,6 +3535,9 @@ EX bool placeSidewall(cell *c, int i, int sidepar, const shiftmatrix& V, color_t
if(arcm::in() && !PURE)
i = gmod(i + arcm::parent_index_of(c->master)/DUALMUL, c->type);
#endif
if(currentmap->strict_tree_rules()) {
i = rulegen::get_arb_dir(c, i);
}
draw_shapevec(c, V2, qfi.fshape->gpside[sidepar][i], col, prio);
return false;
}

View File

@ -39,6 +39,7 @@
#include "kite.cpp"
#include "archimedean.cpp"
#include "arbitrile.cpp"
#include "rulegen.cpp"
#include "euclid.cpp"
#include "sphere.cpp"
#include "fake.cpp"

1568
rulegen.cpp Normal file

File diff suppressed because it is too large Load Diff