Performing Boolean operations on STL files

I have two perform union operation of Two STL files
This STL files can contain two different geometries and we have to merge them
First we have to find the intersection points of two geometries and next recognize point which lies inside the geometry and the point inside geometry should get deleted
now next we have to generate connecting lines to points on surface to create a mesh

check out this library! : GitHub - gkjohnson/three-bvh-csg: A flexible, memory compact, fast and dynamic CSG implementation on top of three-mesh-bvh

Thanks for the reply but i want solution only in cpp

lol this is a javascript forum. :smiley: but… CGAL is probably what you want.

1 Like

oops… thanks for telling me.
Actually I have to do this without using any library. Can you please suggest something else.

What you want to do can be incredibly hard, which is why folks use libraries to achieve it.

It sounds easy until you start trying to do it.

I maintain a CSG library that does what you describe: GitHub - manthrax/THREE-CSGMesh: Conversion of a CSG library for use with modern THREE.js

The core algorithm is here:

Hope this helps, and good luck :slight_smile: