Wesley Ranger
Wesley Ranger

Reputation: 780

Using CGAL, is it possible to perform Boolean operation on open polygon mesh?

I have get to polygon mesh, namely A and B.

A is a closed mesh, B is an arbitrary surface. What I want to do is to cut off the part of B which located outside A. For example, if A is a polygon sphere and B is a rectangular plain, the result shall be a polygon circular plain.

I want to perform the above operation using CGAL (or may be other library if CGAL cannot do this). Any ideas about this?

Upvotes: 3

Views: 2549

Answers (2)

Alexey Lubkin
Alexey Lubkin

Reputation: 11

Regular boolean operations are useless here, e.g. CGAL::Polygon_mesh_processing::corefine_and_compute_intersection(mesh1, mesh2, meshout) requires both mesh1 and mesh2 to be a closed meshes bounding some volumes.

For open mesh use:

CGAL::Polygon_mesh_processing::clip()

Say, mesh1 is open mesh (e.g. square) and mesh2 bounds some volume (e.g. sphere), then you can get intersection of mesh1 and mesh2 by calling:

CGAL::Polygon_mesh_processing::clip(mesh1, mesh2);

The result (a circle) will be saved into mesh1.

If you need difference operation instead (square with circle hole), the same clip() may help either. In this case you need to reverse mesh2 first by swapping orientation of each triangle in mesh2 from counter-clockwise to clockwise. To reverse mesh orientation use:

CGAL::Polygon_mesh_processing::reverse_face_orientations(mesh2);

Upvotes: 1

user2658323
user2658323

Reputation: 553

I think you want the "3D Boolean Operations on Nef Polyhedra" library:

http://doc.cgal.org/latest/Nef_3/index.html

Upvotes: 2

Related Questions