diff --git a/cell.cpp b/cell.cpp index 75b5c86a..c805d3bb 100644 --- a/cell.cpp +++ b/cell.cpp @@ -521,6 +521,33 @@ EX int celldistAlt(cell *c) { return mi; } +/** direction upwards in the tree */ +EX int updir(heptagon *h) { + if(bt::in()) return bt::updir(); + if(WDIM == 3 && reg3::in_rule()) { + for(int i=0; imove(i) && h->move(i)->distance < h->distance) + return i; + return -1; + } + if(h->distance == 0) return -1; + return 0; + } + +/** direction upwards in the alt-tree */ +EX int updir_alt(heptagon *h) { + if(euclid || !h->alt) return -1; + if(WDIM == 3 && reg3::in_rule()) { + for(int i=0; imove(i) && h->move(i)->alt && h->move(i)->alt->distance < h->alt->distance) + return i; + return -1; + } + for(int i=0; imove(i) && h->move(i)->alt == h->alt->move(0)) + return i; + return -1; + } + + #if HDR static const int RPV_MODULO = 5; static const int RPV_RAND = 0; diff --git a/pattern2.cpp b/pattern2.cpp index 3627f78c..1a6e2fd4 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -2543,13 +2543,8 @@ EX namespace linepatterns { linepattern patTree("underlying tree", 0x00d0d000, cheating, ALLCELLS( if(is_master(c)) { - int dir = bt::in() ? bt::updir() : 0; - if(WDIM == 3 && standard_tiling()) { - for(int i=0; imove(i) && c->move(i)->master->distance < c->master->distance) { - dir = i; - break; - } - } + int dir = updir(c->master); + if(dir == -1) continue; cell *c2 = c->master->move(dir)->c7; if(gmatrix.count(c2)) { if(S3 >= OINF) @@ -2562,7 +2557,9 @@ EX namespace linepatterns { ); linepattern patAltTree("circle/horocycle tree", 0xd000d000, cheating, ALLCELLS( - if(is_master(c) && !euclid && c->master->alt) { + if(is_master(c)) { + int dir = updir_alt(c->master); + if(dir == -1) continue; for(int i=0; imaster->move(i) && c->master->move(i)->alt == c->master->alt->move(0)) { cell *c2 = c->master->move(i)->c7;