diff --git a/src/AboutDialog.html b/src/AboutDialog.html index 22ca9272..b2c2cc44 100644 --- a/src/AboutDialog.html +++ b/src/AboutDialog.html @@ -47,12 +47,18 @@ Please visit this link for a copy of the license: GNU GMP
  • GNU MPFR
  • CGAL +
  • Clipper
  • Eigen
  • OpenCSG
  • OpenGL
  • GLEW -
  • Qt Toolkit +
  • Qt Toolkit +
  • QScintilla
  • Boost +
  • GLib +
  • Fontconfig +
  • Freetype +
  • Harfbuzz
  • Bison
  • Flex
  • CMake diff --git a/src/cgalutils-tess.cc b/src/cgalutils-tess.cc index 7a8b80f0..f602d7b1 100644 --- a/src/cgalutils-tess.cc +++ b/src/cgalutils-tess.cc @@ -107,9 +107,9 @@ namespace CGALUtils { else { // Calculate best guess at face normal using Newell's method CGAL::normal_vector_newell_3(polygons.front().begin(), polygons.front().end(), normalvec); - double sqrl = normalvec.squared_length(); - if (sqrl > 0.0) normalvec = normalvec / sqrt(sqrl); } + double sqrl = normalvec.squared_length(); + if (sqrl > 0.0) normalvec = normalvec / sqrt(sqrl); // Pass the normal vector to the (undocumented) // CGAL::Triangulation_2_filtered_projection_traits_3. This @@ -165,6 +165,8 @@ namespace CGALUtils { // Calculate best guess at face normal using Newell's method CGAL::normal_vector_newell_3(polygon.begin(), polygon.end(), normalvec); } + double sqrl = normalvec.squared_length(); + if (sqrl > 0.0) normalvec = normalvec / sqrt(sqrl); // Pass the normal vector to the (undocumented) // CGAL::Triangulation_2_filtered_projection_traits_3. This diff --git a/src/cgalutils.cc b/src/cgalutils.cc index 9287608b..26e74522 100644 --- a/src/cgalutils.cc +++ b/src/cgalutils.cc @@ -892,6 +892,8 @@ namespace CGALUtils { bool createPolySetFromNefPolyhedron3(const CGAL_Nef_polyhedron3 &N, PolySet &ps) { bool err = false; + // Grid all vertices in a Nef polyhedron to merge close vertices. + Grid3d grid(GRID_FINE); CGAL_Nef_polyhedron3::Halffacet_const_iterator hfaceti; CGAL_forall_halffacets(hfaceti, N) { CGAL::Plane_3 plane(hfaceti->plane()); @@ -903,11 +905,22 @@ namespace CGALUtils { CGAL_Nef_polyhedron3::SHalfedge_around_facet_const_circulator c1(cyclei); CGAL_Nef_polyhedron3::SHalfedge_around_facet_const_circulator c2(c1); PolygonK polygon; + std::vector indices; // Vertex indices in one polygon CGAL_For_all(c1, c2) { CGAL_Point_3 p = c1->source()->center_vertex()->point(); - polygon.push_back(Vertex3K(CGAL::to_double(p.x()), CGAL::to_double(p.y()), CGAL::to_double(p.z()))); + Vector3d v = vector_convert(p); + indices.push_back(grid.align(v)); + polygon.push_back(Vertex3K(v[0], v[1], v[2])); } - polyholes.push_back(polygon); + // Remove consecutive duplicate vertices + PolygonK::iterator currp = polygon.begin(); + for (int i=0;i= 3) polyholes.push_back(polygon); } /* at this stage, we have a sequence of polygons. the first