fix hole orientation to make inner offset work for holes
Stefan Schuermans

Stefan Schuermans commited on 2013-01-27 21:56:40
Showing 1 changed files, with 6 additions and 2 deletions.

... ...
@@ -124,9 +124,13 @@ bool Polygons::addLayer(const Layer &layer, double eqDist)
124 124
     if (contained_in.at(ia) < 0) {
125 125
       CgPolyHoles poly(simples.at(ia));
126 126
       // find and add holes
127
-      for (ib = 0; (size_t)ib < contained_in.size(); ++ib)
128
-        if (contained_in.at(ib) == ia)
127
+      for (ib = 0; (size_t)ib < contained_in.size(); ++ib) {
128
+        if (contained_in.at(ib) == ia) {
129
+          // holes must be counter-clockwise
130
+          simples.at(ib).reverse_orientation();
129 131
           poly.add_hole(simples.at(ib));
132
+        }
133
+      }
130 134
       // add polygon to member variable
131 135
       mPolys.push_back(poly);
132 136
     }
133 137