From 59619fb6cd970a85952ef11bdf6cc19ee99dad7b Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Fri, 23 Sep 2016 17:52:18 -0700 Subject: [PATCH] Crunch out zero-length linetos to improve the match --- tile.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tile.cpp b/tile.cpp index 14b4e37..ad4f67e 100644 --- a/tile.cpp +++ b/tile.cpp @@ -568,6 +568,25 @@ int manage_gap(unsigned long long index, unsigned long long *previndex, double s void find_common_edges(std::vector &partials) { std::map> edges; + for (size_t i = 0; i < partials.size(); i++) { + if (partials[i].t == VT_POLYGON) { + for (size_t j = 0; j < partials[i].geoms.size(); j++) { + drawvec &g = partials[i].geoms[j]; + drawvec out; + + for (size_t k = 0; k < g.size(); k++) { + if (g[k].op == VT_LINETO && k > 0 && g[k - 1] == g[k]) { + ; + } else { + out.push_back(g[k]); + } + } + + partials[i].geoms[j] = out; + } + } + } + // Construct a mapping from all polygon edges to the set of rings // that each edge appears in. (The ring number is across all polygons; // we don't need to look it back up, just to tell where it changes.) @@ -674,6 +693,16 @@ void find_common_edges(std::vector &partials) { } if (e1->second != e2->second) { +#if 0 + for (auto it = e1->second.begin(); it != e1->second.end(); it++) { + printf("%lu ", *it); + } + printf("!= "); + for (auto it = e2->second.begin(); it != e2->second.end(); it++) { + printf("%lu ", *it); + } + printf("\n"); +#endif g[a + k].necessary = 1; } }