From dfd213fc7375f5f5bcf64e2cc8c5663538824c3d Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 16 Jun 2024 23:13:49 +0200 Subject: [PATCH] twist:: correct plevel values for all nil --- archimedean.cpp | 10 ++++++++++ geometry.cpp | 17 ++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/archimedean.cpp b/archimedean.cpp index 546da968..5a7c3de4 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -89,6 +89,8 @@ struct archimedean_tiling { bool get_step_values(int& steps, int& single_step); + ld dual_tile_area(); + transmatrix adjcell_matrix(heptagon *h, int d); ld scale(); @@ -1588,6 +1590,14 @@ EX int get_graphical_id(cell *c) { return tid; } +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"); + ld total = 0; + for(auto r: inradius) total += r; + return total * edgelength / 2; + } + bool archimedean_tiling::get_step_values(int& steps, int& single_step) { int nom = -2; diff --git a/geometry.cpp b/geometry.cpp index 30cc65fb..5da3b4e5 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -733,7 +733,7 @@ void geometry_information::prepare_basics() { #if CAP_BT else if(bt::in()) bt::create_faces(); #endif - else if(nil) nilv::create_faces(); + else if(nil && !mtwisted) nilv::create_faces(); #endif scalefactor = crossf / hcrossf7; @@ -809,7 +809,7 @@ void geometry_information::prepare_basics() { plevel = vid.plevel_factor * scalefactor; single_step = 1; - if(mhybrid && !mproduct) { + if(mtwisted && ginf[hybrid::underlying].cclass != gcEuclid) { #if CAP_ARCM if(hybrid::underlying == gArchimedean) arcm::current.get_step_values(psl_steps, single_step); @@ -825,11 +825,14 @@ void geometry_information::prepare_basics() { } DEBB(DF_GEOM | DF_POLY, ("steps = ", psl_steps, " / ", single_step)); plevel = M_PI * single_step / psl_steps; - - if(hybrid::underlying == gEuclid && PURE) { - cgi.plevel = sqrt(3)/4.; - single_step = 1; - } + } + if(mtwisted && ginf[hybrid::underlying].cclass == gcEuclid) { + single_step = 1; + if(hybrid::underlying == gArchimedean) plevel = arcm::current.dual_tile_area(); + if(hybrid::underlying == gEuclid && PURE) plevel = sqrt(3)/4.; + if(hybrid::underlying == gEuclidSquare && PURE) plevel = 1; + if(hybrid::underlying == gEuclidSquare && BITRUNCATED) plevel = 0.25; + if(hybrid::underlying == gEuclid && BITRUNCATED) plevel = sqrt(3)/12.; } set_sibling_limit();