diff --git a/src/BuildTiles/Main/construct.cxx b/src/BuildTiles/Main/construct.cxx index 607bd6e0..4eb35cc7 100644 --- a/src/BuildTiles/Main/construct.cxx +++ b/src/BuildTiles/Main/construct.cxx @@ -51,8 +51,7 @@ using std::string; -//double gSnap = 0.00000001; // approx 1 mm -double gSnap = 0.0000002; // approx 2 cm +double gSnap = 0.00000001; // approx 1 mm static const double cover_size = 1.0 / 120.0; static const double half_cover_size = cover_size * 0.5; @@ -1853,7 +1852,7 @@ void TGConstruct::TesselatePolys( void ) ": id = " << id ); // TGPolygon tri = polygon_tesselate_alt_with_extra( poly, poly_extra, false ); - TGPolygon tri = polygon_tesselate_alt_with_extra( poly, poly_extra, false ); + TGPolygon tri = polygon_tesselate_alt_with_extra_cgal( poly, poly_extra, false ); // ensure all added nodes are accounted for for (int k=0; k< tri.contours(); k++) { diff --git a/src/Lib/Geometry/poly_cgal.cxx b/src/Lib/Geometry/poly_cgal.cxx index c20b822b..b5be6bee 100644 --- a/src/Lib/Geometry/poly_cgal.cxx +++ b/src/Lib/Geometry/poly_cgal.cxx @@ -114,7 +114,15 @@ TGPolygon polygon_tesselate_alt_with_extra_cgal( TGPolygon &p, const point_list& return result; } - // insert each polygon into the triangulation + // First, insert the extra points + std::vector points; + points.reserve(extra_nodes.size()); + for (unsigned int n = 0; n < extra_nodes.size(); n++) { + points.push_back( Point(extra_nodes[n].x(), extra_nodes[n].y()) ); + } + cdt.insert(points.begin(), points.end()); + + // then insert each polygon as a constraint into the triangulation for (int c = 0; c < p.contours(); c++) { point_list contour = p.get_contour( c ); Polygon_2 poly; @@ -148,4 +156,4 @@ TGPolygon polygon_tesselate_alt_with_extra_cgal( TGPolygon &p, const point_list& } return result; -} \ No newline at end of file +}