MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / create_polyhedron

Method create_polyhedron

src/ifcgeom/kernels/cgal/CgalKernel.cpp:56–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders) {
57
58 // Naive creation
59 CGAL::Polyhedron_3<Kernel_> polyhedron;
60 PolyhedronBuilder builder(&face_list);
61 polyhedron.delegate(builder);
62 if (builder.from_soup) {
63 polyhedron = *builder.from_soup;
64 }
65
66 // Stitch edges
67 // std::cout << "Before: " << polyhedron.size_of_vertices() << " vertices and " << polyhedron.size_of_facets() << " facets" << std::endl;
68
69 if (stitch_borders) {
70 // we have a map of points now in the builder, it's maybe not necessary anymore to stitch_borders?
71 // size_t ne = polyhedron.size_of_border_edges();
72 CGAL::Polygon_mesh_processing::stitch_borders(polyhedron);
73 // size_t ne2 = polyhedron.size_of_border_edges();
74 // std::wcout << (ne - ne2) << " removed" << std::endl;
75 }
76
77 polyhedron.normalize_border();
78 if (!polyhedron.is_valid(false, 1)) {
79 Logger::Message(Logger::LOG_ERROR, "create_polyhedron: Polyhedron not valid!");
80 // std::ofstream fresult;
81 // fresult.open("/Users/ken/Desktop/invalid.off");
82 // fresult << polyhedron << std::endl;
83 // fresult.close();
84 return CGAL::Polyhedron_3<Kernel_>();
85 }
86
87 // std::cout << "After: " << polyhedron.size_of_vertices() << " vertices and " << polyhedron.size_of_facets() << " facets" << std::endl;
88
89 return polyhedron;
90}
91
92#ifndef IFOPSH_SIMPLE_KERNEL
93CGAL::Polyhedron_3<Kernel_> ifcopenshell::geometry::utils::create_polyhedron(const CGAL::Nef_polyhedron_3<Kernel_>& nef_polyhedron) {

Callers

nothing calls this directly

Calls 2

MessageClass · 0.85
is_validMethod · 0.80

Tested by

no test coverage detected