arcm:: more efficient when actually regular

This commit is contained in:
Zeno Rogue 2020-07-03 15:40:26 +02:00
parent 02ebc8a96a
commit 39ac36c4aa
2 changed files with 13 additions and 4 deletions

View File

@ -32,6 +32,8 @@ struct archimedean_tiling {
int repetition; int repetition;
int N; int N;
bool regular;
ld euclidean_angle_sum; 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)))); for(auto& t: ts) DEBB0(DF_GEOM, (format(" %f@%f", float(t.first), float(t.second))));
DEBB(DF_GEOM, ()); DEBB(DF_GEOM, ());
} }
regular = true;
for(int i: faces) if(i != faces[0]) regular = false;
} }
ld archimedean_tiling::scale() { ld archimedean_tiling::scale() {

View File

@ -696,6 +696,7 @@ void geometry_information::generate_floorshapes() {
arcm::parent_index_of(&modelh) = 0; arcm::parent_index_of(&modelh) = 0;
auto &ac = arcm::current; auto &ac = arcm::current;
for(int i=0; i<2*ac.N + 2; i++) { 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; arcm::id_of(&modelh) = i;
model.type = isize(ac.triangles[i]); model.type = isize(ac.triangles[i]);
if(DUAL) model.type /= 2, arcm::parent_index_of(&modelh) = !(i&1); 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); return gp::get_plainshape_id(c);
else if(IRREGULAR) else if(IRREGULAR)
return irr::cellindex[c]; return irr::cellindex[c];
else if(arcm::in()) else if(arcm::in()) {
return arcm::id_of(c->master); 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()) else if(arb::in())
return arb::id_of(c->master); return arb::id_of(c->master);
else if(geosupport_football() == 2) else if(geosupport_football() == 2)
@ -935,7 +940,7 @@ EX struct dqi_poly *draw_shapevec(cell *c, const transmatrix& V, const vector<hp
#endif #endif
#if CAP_ARCM #if CAP_ARCM
else if(arcm::in()) { else if(arcm::in()) {
return &queuepolyat(V, shv[arcm::id_of(c->master)], col, prio); return &queuepolyat(V, shv[shvid(c)], col, prio);
} }
#endif #endif
else if(GOLDBERG && ishex1(c)) else if(GOLDBERG && ishex1(c))