CSG on mesh?


Has anybody tried to do csg on meshes?

I have speed problems and I thought one solution could be to mesh the solids and do csg on the meshes.

(Instead of doing csg on the geometry and then mesh.)
It should be much faster and the accuracy would be perfect for me.
If someone has suggestions, please let me know!


QbProg's picture

mmm , I think opencascade is not the best tool for doing CSG. You could try to integrate Netgen that does CSG on meshes (and imports from OpenCascade).

If you just need CSG rendering, try OpenCSG. Since it's image base you can not get the resulting mesh.

Good bye

avivh's picture

I'm doing CSG on meshes using OC. And yes, it is slow.

QbProg's picture

are you using Topology to do that?

avivh's picture

Sorry for the late response.

I build the meshes with a Sewing object.
Then I convert into a solid.
Then I do the CSG Operation.
Then I do a Triangulation (because I work with triangular meshes).
Then I read the coordinates of the triangulation - that's the result of my procedure.

avivh's picture

If it wasn't clear, I use BrepAlgoAPI, e.g. BRepAlgoAPI_Cut().

avivh's picture

Other thoughts I've had on this issue:
a. OpenCASCADE does the CSG operations on meshes well but I'm convinced they're slower than they should be. I think the framework deals with the general BREP case and doesn't take advantage of that fact that its dealing with meshes, so it probably misses optimizations. It is too general to be efficient.
b. I tried to figure out how to do mesh CSG on my own, but so far no luck. I have Computer Science education but haven't taken any courses in topology, I might be missing some crucial math for this. Can anybody send me references on this issue?
c. Note that any modelling software has mesh-CSG capability and is probably optimized for CSG of meshes in particular. For example, 3D-studio, AutoCAD and the open-source Blender can all do this. The question is, how would you take advantage of their capabilities? It requires some non-standard interfacing that I haven't seen done anywhere.

QbProg's picture

Netgen too does CSG on meshes. Till now I was not able to get CSG meshes with any other lib (don't use standalone programs). Good CSG libs use CSG but only for rendering (and it's very fast). The bad thing is that you can't get the result .

If you ever find a good lib, plase point it here!