From ef51ee8a7fc855bd06f82ac24fdcab5fa2a98815 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 16:36:49 -0500 Subject: use the CGAL triangulation with intersections enabled. attempt to fix issue #159 diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index f221e3a..9cd3bfd 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -24,7 +24,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Triangulation_vertex_base_2 Vb; typedef CGAL::Delaunay_mesh_face_base_2 Fb; typedef CGAL::Triangulation_data_structure_2 Tds; -typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; +typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; //typedef CGAL::Delaunay_mesh_criteria_2 Criteria; typedef CDT::Vertex_handle Vertex_handle; -- cgit v0.10.1 From f16d3a65a1176475f0c71676d6bf0640fabe45c6 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 16:43:04 -0500 Subject: print only a single warning about intersecting vertices at dxf tessellation , instead of spamming it over and over. also mention that it might be due to intersecting lines, not just duplicate vertices (duplicate vertices being perhaps generated by cgal's tessellator when it deals with intersecting lines) diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index 9cd3bfd..506b34a 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -109,6 +109,7 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr Grid2d point_info(GRID_FINE); boost::unordered_map edge_to_triangle; boost::unordered_map edge_to_path; + int duplicate_vertices = 0; CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); try { @@ -131,7 +132,7 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr // ..maybe it would be better to assert here. But this would // break compatibility with the glu tesselator that handled such // cases just fine. - PRINT( "WARNING: Duplicate vertex found during Tessellation. Render may be incorrect." ); + duplicate_vertices++; continue; } @@ -165,6 +166,9 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr } } + if ( duplicate_vertices > 0 ) + PRINTB( "WARNING: duplicate vertices and/or intersecting lines found during DXF Tessellation. Render may be incorrect.", duplicate_vertices ); + } catch (CGAL::Assertion_exception e) { PRINTB("CGAL error in dxf_tesselate(): %s", e.what()); -- cgit v0.10.1 From 40149978574a58ac421373e58e1f77478fdd4f67 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 16:45:24 -0500 Subject: fix print statement diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index 506b34a..5ddcfbf 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -167,7 +167,7 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr } if ( duplicate_vertices > 0 ) - PRINTB( "WARNING: duplicate vertices and/or intersecting lines found during DXF Tessellation. Render may be incorrect.", duplicate_vertices ); + PRINT( "WARNING: duplicate vertices and/or intersecting lines found during DXF Tessellation. Render may be incorrect." ); } catch (CGAL::Assertion_exception e) { -- cgit v0.10.1 From b4c023d84bc8d2732eb0ae7349146e5c8b0fbd5f Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 19 Aug 2012 16:49:37 -0500 Subject: Capitalize 'duplicate' diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index 5ddcfbf..df04b5b 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -167,7 +167,7 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr } if ( duplicate_vertices > 0 ) - PRINT( "WARNING: duplicate vertices and/or intersecting lines found during DXF Tessellation. Render may be incorrect." ); + PRINT( "WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation. Render may be incorrect." ); } catch (CGAL::Assertion_exception e) { -- cgit v0.10.1 From 5c779159c208ca3d88c88479ab29f9cd66574859 Mon Sep 17 00:00:00 2001 From: don bright Date: Tue, 8 Jan 2013 05:06:26 +0100 Subject: new test results (degenerate polygons produce output) diff --git a/tests/regression/cgalpngtest/polygon-intersect-expected.png b/tests/regression/cgalpngtest/polygon-intersect-expected.png index 6f4f437..54e8d6b 100644 Binary files a/tests/regression/cgalpngtest/polygon-intersect-expected.png and b/tests/regression/cgalpngtest/polygon-intersect-expected.png differ diff --git a/tests/regression/cgalpngtest/polygon-mesh-expected.png b/tests/regression/cgalpngtest/polygon-mesh-expected.png index 6f4f437..a8fe41a 100644 Binary files a/tests/regression/cgalpngtest/polygon-mesh-expected.png and b/tests/regression/cgalpngtest/polygon-mesh-expected.png differ diff --git a/tests/regression/cgalpngtest/polygon-self-intersect-expected.png b/tests/regression/cgalpngtest/polygon-self-intersect-expected.png index 6f4f437..b93b5fb 100644 Binary files a/tests/regression/cgalpngtest/polygon-self-intersect-expected.png and b/tests/regression/cgalpngtest/polygon-self-intersect-expected.png differ diff --git a/tests/regression/opencsgtest/polygon-intersect-expected.png b/tests/regression/opencsgtest/polygon-intersect-expected.png index 6f4f437..c0a3cc9 100644 Binary files a/tests/regression/opencsgtest/polygon-intersect-expected.png and b/tests/regression/opencsgtest/polygon-intersect-expected.png differ diff --git a/tests/regression/opencsgtest/polygon-mesh-expected.png b/tests/regression/opencsgtest/polygon-mesh-expected.png index 6f4f437..b907a74 100644 Binary files a/tests/regression/opencsgtest/polygon-mesh-expected.png and b/tests/regression/opencsgtest/polygon-mesh-expected.png differ diff --git a/tests/regression/opencsgtest/polygon-self-intersect-expected.png b/tests/regression/opencsgtest/polygon-self-intersect-expected.png index 6f4f437..899bb6f 100644 Binary files a/tests/regression/opencsgtest/polygon-self-intersect-expected.png and b/tests/regression/opencsgtest/polygon-self-intersect-expected.png differ diff --git a/tests/regression/throwntogethertest/polygon-intersect-expected.png b/tests/regression/throwntogethertest/polygon-intersect-expected.png index 81eb514..d889f06 100644 Binary files a/tests/regression/throwntogethertest/polygon-intersect-expected.png and b/tests/regression/throwntogethertest/polygon-intersect-expected.png differ diff --git a/tests/regression/throwntogethertest/polygon-mesh-expected.png b/tests/regression/throwntogethertest/polygon-mesh-expected.png index 81eb514..1c2751c 100644 Binary files a/tests/regression/throwntogethertest/polygon-mesh-expected.png and b/tests/regression/throwntogethertest/polygon-mesh-expected.png differ diff --git a/tests/regression/throwntogethertest/polygon-self-intersect-expected.png b/tests/regression/throwntogethertest/polygon-self-intersect-expected.png index 81eb514..ebce31e 100644 Binary files a/tests/regression/throwntogethertest/polygon-self-intersect-expected.png and b/tests/regression/throwntogethertest/polygon-self-intersect-expected.png differ -- cgit v0.10.1 From 6f0a0fff9ec271ec9da31f319f9dfabdae569d1e Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 27 Jan 2013 20:57:50 -0600 Subject: make it clear to the user that they can't rely on this behavior diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index e40f1d3..0197473 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -166,8 +166,10 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool /* do_tr } } - if ( duplicate_vertices > 0 ) - PRINT( "WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation. Render may be incorrect." ); + if ( duplicate_vertices > 0 ) { + PRINT( "WARNING: Duplicate vertices and/or intersecting lines found during DXF Tessellation." ); + PRINT( "WARNING: Modify the polygon to be a Simple Polygon. Render is incomplete." ); + } } catch (const CGAL::Assertion_exception &e) { -- cgit v0.10.1