mirror of https://github.com/vitalif/openscad
Merge remote-tracking branch 'origin/master' into libtess2
commit
7b16891cc5
|
@ -47,12 +47,18 @@ Please visit this link for a copy of the license: <a href="http://www.gnu.org/li
|
|||
<li><a href="http://gmplib.org/">GNU GMP</a>
|
||||
<li><a href="http://www.mpfr.org/">GNU MPFR</a>
|
||||
<li><a href="http://www.cgal.org">CGAL</a>
|
||||
<li><a href="http://www.angusj.com/delphi/clipper.php">Clipper</a>
|
||||
<li><a href="http://eigen.tuxfamily.org">Eigen</a>
|
||||
<li><a href="http://www.opencsg.org">OpenCSG</a>
|
||||
<li><a href="http://www.opengl.org/">OpenGL</a>
|
||||
<li><a href="http://glew.sourceforge.net">GLEW</a>
|
||||
<li><a href="http://qt.nokia.com">Qt Toolkit</a>
|
||||
<li><a href="http://qt-project.org">Qt Toolkit</a>
|
||||
<li><a href="http://www.riverbankcomputing.co.uk/software/qscintilla">QScintilla</a>
|
||||
<li><a href="http://www.boost.org">Boost</a>
|
||||
<li><a href="https://developer.gnome.org/glib">GLib</a>
|
||||
<li><a href="http://fontconfig.org">Fontconfig</a>
|
||||
<li><a href="http://freetype.org">Freetype</a>
|
||||
<li><a href="http://harfbuzz.org">Harfbuzz</a>
|
||||
<li><a href="http://www.gnu.org/software/bison/">Bison</a>
|
||||
<li><a href="http://flex.sourceforge.net/">Flex</a>
|
||||
<li><a href="http://www.cmake.org">CMake</a>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<int> grid(GRID_FINE);
|
||||
CGAL_Nef_polyhedron3::Halffacet_const_iterator hfaceti;
|
||||
CGAL_forall_halffacets(hfaceti, N) {
|
||||
CGAL::Plane_3<CGAL_Kernel3> 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<int> 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<Vector3d>(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<indices.size();i++) {
|
||||
if (indices[i] != indices[(i+1)%indices.size()]) {
|
||||
(*currp++) = polygon[i];
|
||||
}
|
||||
}
|
||||
polygon.erase(currp, polygon.end());
|
||||
if (polygon.size() >= 3) polyholes.push_back(polygon);
|
||||
}
|
||||
|
||||
/* at this stage, we have a sequence of polygons. the first
|
||||
|
|
Loading…
Reference in New Issue