From 39ac36c4aabd13635711ab62f684dacb20b762e4 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 3 Jul 2020 15:40:26 +0200 Subject: [PATCH] arcm:: more efficient when actually regular --- archimedean.cpp | 6 +++++- floorshapes.cpp | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/archimedean.cpp b/archimedean.cpp index ab3d3247..04b436ee 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -32,6 +32,8 @@ struct archimedean_tiling { int repetition; int N; + + bool regular; ld euclidean_angle_sum; @@ -471,7 +473,9 @@ void archimedean_tiling::compute_geometry() { for(auto& t: ts) DEBB0(DF_GEOM, (format(" %f@%f", float(t.first), float(t.second)))); DEBB(DF_GEOM, ()); } - + + regular = true; + for(int i: faces) if(i != faces[0]) regular = false; } ld archimedean_tiling::scale() { diff --git a/floorshapes.cpp b/floorshapes.cpp index 425dd4d5..5c820171 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -696,6 +696,7 @@ void geometry_information::generate_floorshapes() { arcm::parent_index_of(&modelh) = 0; auto &ac = arcm::current; for(int i=0; i<2*ac.N + 2; i++) { + if(ac.regular && i>=2 && i < 2*ac.N) continue; arcm::id_of(&modelh) = i; model.type = isize(ac.triangles[i]); if(DUAL) model.type /= 2, arcm::parent_index_of(&modelh) = !(i&1); @@ -867,8 +868,12 @@ EX int shvid(cell *c) { return gp::get_plainshape_id(c); else if(IRREGULAR) return irr::cellindex[c]; - else if(arcm::in()) - return arcm::id_of(c->master); + else if(arcm::in()) { + auto& ac = arcm::current; + int id = arcm::id_of(c->master); + if(ac.regular && id>=2 && id < 2*ac.N) id &= 1; + return id; + } else if(arb::in()) return arb::id_of(c->master); else if(geosupport_football() == 2) @@ -935,7 +940,7 @@ EX struct dqi_poly *draw_shapevec(cell *c, const transmatrix& V, const vectormaster)], col, prio); + return &queuepolyat(V, shv[shvid(c)], col, prio); } #endif else if(GOLDBERG && ishex1(c))