From 0d7f6af681dc0d0ed4c2f16e32c277d71b6f3a64 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 28 Aug 2019 16:15:28 +0200 Subject: [PATCH] Mesh compound prior to voxelization --- src/ifcgeomserver/IfcGeomServer.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ifcgeomserver/IfcGeomServer.cpp b/src/ifcgeomserver/IfcGeomServer.cpp index ddade4ede7..cc00daef84 100644 --- a/src/ifcgeomserver/IfcGeomServer.cpp +++ b/src/ifcgeomserver/IfcGeomServer.cpp @@ -529,7 +529,7 @@ public: // Sometimes geometries are not a topologically valid manifold, // but still (approximately) enclose a volume. In this case // we can voxlize the geometry and fill the interior solid volume. - if (has_boundingbox) { + else if (has_boundingbox) { std::array< vec_n<3, double>, 2 > bounds; for (int i = 0; i < 3; ++i) { bounds[0].get(i) = bbox_xyz[i + 0]; @@ -541,6 +541,14 @@ public: // voxels. auto surface = storage_for(bounds, 128U, 4U); processor proc(surface, silent); + // @todo is scanline entirely reliable due to rounding from float to int? + // This is also observed in voxec dump_surfaces(). + // proc.use_scanline() = false; + // @todo we still cannot correctly identify hollow objects correctly. + // is it an idea to use several points we know should be inside the volume? + // Or, use a boolean intersection of surface and volume and subtract any subsequent + // interior void volumes. + BRepMesh_IncrementalMesh(compound, 0.001); std::vector > geometries = { {1, compound} }; proc.process(geometries.begin(), geometries.end(), SURFACE(), output(MERGED())); surface = (regular_voxel_storage*) proc.voxels();