diff --git a/archimedean.cpp b/archimedean.cpp index 5b3dce0e..fee625b3 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -111,7 +111,7 @@ EX archimedean_tiling current; EX archimedean_tiling fake_current; EX archimedean_tiling& current_or_fake() { - if(fake::in()) return fake_current; + if(fake::in_ext()) return fake_current; return current; } @@ -437,7 +437,7 @@ void archimedean_tiling::compute_geometry() { DEBB(DF_GEOM, (hr::format("euclidean_angle_sum = %f\n", float(euclidean_angle_sum)))); - bool infake = fake::in(); + bool infake = fake::in_ext(); dynamicval dv(geometry, gArchimedean); @@ -1592,8 +1592,16 @@ EX int get_graphical_id(cell *c) { } ld archimedean_tiling::dual_tile_area() { - // we need this only in Euclidean for now - if(get_geometry().kind != gcEuclid) throw hr_exception("dual_tile_area only implemented in Euclidean"); + /* this will work both in Euclidean and non-Euclidean cases */ + /* (note: we cannot just check get_geometry() here because we might be fake) */ + + ld total_alpha = 0; + for(auto a: alphas) total_alpha += a; + + if(abs(total_alpha - M_PI) > 1e-6) { + return 2 * abs(M_PI - total_alpha); + } + ld total = 0; for(auto r: inradius) total += r; return total * edgelength / 2; diff --git a/fake.cpp b/fake.cpp index 7bdd5924..6bcff3e9 100644 --- a/fake.cpp +++ b/fake.cpp @@ -23,6 +23,8 @@ EX namespace fake { EX bool in() { return geometry == gFake; } + EX bool in_ext() { return in() || (mhybrid && PIU(in())); } + EX void on_dim_change() { pmap->on_dim_change(); } /** like in() but takes slided arb into account */ diff --git a/geometry.cpp b/geometry.cpp index 7dabfac0..b784b677 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -746,7 +746,7 @@ void geometry_information::prepare_basics() { #if CAP_ARCM if(arcm::in()) { auto& ac = arcm::current_or_fake(); - if(fake::in()) ac = arcm::current; + if(fake::in_ext()) ac = arcm::current; ac.compute_geometry(); crossf = hcrossf7 * ac.scale(); hexvdist = ac.scale() * .5; @@ -882,7 +882,7 @@ void geometry_information::prepare_basics() { } if(mtwisted && underlying_euclid) { single_step = 1; - if(ug == gArchimedean) plevel = arcm::current.dual_tile_area(); + if(ug == gArchimedean) plevel = arcm::current_or_fake().dual_tile_area(); if(ug == gEuclid && PURE) plevel = sqrt(3)/4.; if(ug == gEuclidSquare && PURE) plevel = 1; if(ug == gEuclidSquare && BITRUNCATED) plevel = 0.25;