Squashed some bugs

This commit is contained in:
Ken Arroyo Ohori
2017-03-30 19:04:39 -06:00
parent 583c334802
commit ed9676ed38
5 changed files with 53 additions and 11 deletions
@@ -51,8 +51,28 @@ CGAL::Polyhedron_3<Kernel> IfcGeom::CgalKernel::create_polyhedron(std::list<cgal
return polyhedron;
}
CGAL::Polyhedron_3<Kernel> IfcGeom::CgalKernel::create_polyhedron(CGAL::Nef_polyhedron_3<Kernel> &nef_polyhedron) {
if (nef_polyhedron.is_simple()) {
CGAL::Polyhedron_3<Kernel> polyhedron;
nef_polyhedron.convert_to_polyhedron(polyhedron);
return polyhedron;
} else {
std::cout << "Nef polyhedron not simple: cannot create polyhedron!" << std::endl;
return CGAL::Polyhedron_3<Kernel>();
}
}
CGAL::Nef_polyhedron_3<Kernel> IfcGeom::CgalKernel::create_nef_polyhedron(std::list<cgal_face_t> &face_list) {
CGAL::Polyhedron_3<Kernel> polyhedron = create_polyhedron(face_list);
return CGAL::Nef_polyhedron_3<Kernel>(polyhedron);
}
CGAL::Nef_polyhedron_3<Kernel> IfcGeom::CgalKernel::create_nef_polyhedron(CGAL::Polyhedron_3<Kernel> &polyhedron) {
if (polyhedron.is_valid()) {
CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron);
return CGAL::Nef_polyhedron_3<Kernel>(polyhedron);
} else {
std::cout << "Polyhedron not valid: cannot create Nef polyhedron!" << std::endl;
return CGAL::Nef_polyhedron_3<Kernel>();
}
}