2
votes

I'm new to CGAL and I'm trying to cut a cube with an arbitrary surface mesh in 3d (no self intersections, not closed/no volume). The goal is to get a volume which consists of one "side" of the cut cube, closed by the part of the surface inside the cube.

The surface itself consists of unordered triangles which should have the same winding order (consistent normal directions) but have no neighborhood information and could contain same points multiple times for different triangles.

I tried to use the clip function, like:

    CGAL::Polygon_mesh_processing::clip(cube,surface,true);

Which of course does not work because the surface is not closed (as far as I understood). But It shows the idea on how the operation should work.

Boolean operations (https://doc.cgal.org/latest/Polygon_mesh_processing/index.html#title14)) cannot be used for this as well since they are calculated on volumes and the surface has no volume.

I also thought about extending the outside of the surface so that it is closed. This, however, does not seem like a good approach.

Sadly, my research on similar problems was not successful.

I'm pretty sure that there is a nice way to do this in CGAL. Maybe someone with more experience in CGAL knows how to do this.

What would be the best approach for getting this volume?

Regards

EDIT:

By removing redundant points in my surface mesh I was able to get clip to work. Nevertheless, I do not always get the right side of the volume, even though the winding order should yield normals which point to the outside. Is it necessary to calculate the normals and pass them as an extra parameter (see here) of the surface before the cut in order to always get the same "inner" side of the volume?

Also, the clip function seems to be quite slow. I have to do this cut for a very high number of cubes and different surfaces. I use CGAL as header only lib and without GMP and MPFR, since it crashed my other application. How big is the speedup using these libraries and are there any other tricks which can be used to speedup computation, e.g. using parallelization?

I saw that CGAL uses Intel's TBB which. But in the header files which are included by the clipping algorithm CGAL_LINKED_WITH_TBB is not tested.

Thanks

1
Why does clip do not work? If the intersection is a close curve it should not be an issue.sloriot
You should be able to trick clip() by extruding your clipper so that it becomes closed, which is easier than "extending the outside of the surface", using extrude_mesh()mgimeno
I was able to use clipping the way I mentioned it above. I just removed redundant points int my surface. Now it is working. However, I do not always get the right side of my volume even though I'm sure the normals of the surface always point in the right direction. See Edit in my question.user3884995

1 Answers

0
votes

It was a problem with the clipping mesh. Clipping could not be done properly. I increased it size and now it always intersects the volume.