Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a0632ec
add new implementation of Booleans operations on triangle soups
sloriot Mar 6, 2026
b0d8650
add an option to test for intersection only triangles from different …
sloriot Apr 8, 2026
377ef13
add draft code for self-union
sloriot Apr 16, 2026
626c746
add reference manual
sloriot Aug 11, 2026
fdf3619
Merge remote-tracking branch 'cgal/main' into PMP-autoref_boolops
sloriot Aug 11, 2026
5669fe3
add the self-union example as a test for now
sloriot Aug 11, 2026
9b3a6cb
update changes
sloriot Aug 11, 2026
32a58b6
PMP: Corefinement polish documentation
afabri May 20, 2026
84d3b99
improved doc
sloriot Aug 11, 2026
537b094
mention Sosno
sloriot Aug 11, 2026
f84b34e
add secton about non-manifold BO in the user manual
sloriot Aug 11, 2026
d1e8f1f
update SPDX
sloriot Aug 11, 2026
fe2f6c1
fix function name
sloriot Aug 17, 2026
ec3a1aa
typos
sloriot Oct 5, 2026
3c43d78
add soup_union example
LeoValque Oct 8, 2026
fdc09b2
fill the point map is now parallellize
LeoValque Oct 9, 2026
33918a6
[COREFINE] use a canonical vector for face triangulation
sloriot Oct 9, 2026
90b387d
Rewrite connected_components to use vector of adjacence instead of an…
LeoValque Oct 12, 2026
4192078
Merge branch 'PMP-autoref_boolops' of github.com:sloriot/cgal into HEAD
LeoValque Oct 12, 2026
c9b584e
Add test corefinement vs autorefine
LeoValque Oct 13, 2026
a2dca25
Add timers in autoref-boolop
LeoValque Oct 14, 2026
a368e20
Duplace non manifold edges before to compare faces
LeoValque Oct 14, 2026
77947bf
compatibility with filesystem
sloriot Oct 14, 2026
dbdb777
typo
sloriot Oct 14, 2026
a73179e
fix exact point positions
sloriot Oct 14, 2026
cb92dbc
constexpr
sloriot Oct 14, 2026
1a65720
update timers
LeoValque Oct 14, 2026
2814758
Parallelize build connectivity
LeoValque Oct 14, 2026
b1d265d
Merge branch 'PMP-autoref_boolops' of github.com:sloriot/cgal into HEAD
LeoValque Oct 14, 2026
659dc93
Parallelize the call of connected components using split_at_range
LeoValque Oct 15, 2026
9f1f37c
Move misplace #ifdef CGAL_LINKED_WITH_TBB
LeoValque Oct 15, 2026
8d50e1e
Remove leftover assertion
LeoValque Oct 15, 2026
5f1af6e
Remove now unused argument
LeoValque Oct 15, 2026
c4677c3
Transfer point map to compute_intersecting_pairs
LeoValque Oct 15, 2026
b4e8c18
Correct argument error in calling connected_components
LeoValque Oct 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Installation/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Release date: December 2026
- The corefinement based operations (including Boolean operations) has been optimized to better
handle cases when some identical faces are shared between the input meshes. This leads to a significant speed up
in those cases.
- Added new multithreading compatible functions operating directly on triangle soups, enabling the handling of non-manifold input and output volumes:
`CGAL::Polygon_mesh_processing::compute_union()`, `CGAL::Polygon_mesh_processing::compute_intersection()`, and
`CGAL::Polygon_mesh_processing::compute_difference()`.

## [Release 6.2](https://github.com/CGAL/cgal/releases/tag/v6.2)

Expand Down
2 changes: 0 additions & 2 deletions PMP_Boolean_operations/doc/PMP_Boolean_operations/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ HIDE_UNDOC_CLASSES = true
WARN_IF_UNDOCUMENTED = false

EXCLUDE_SYMBOLS += experimental

HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/kernel.png
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ of the geometry processing toolkit, with numerous applications in CAD and
computer graphics. As an example, it constitutes the essential operation of Constructive Solid Geometry (CSG).

This \cgal package offers functions to compute the union, intersection, and difference
of volumes bounded by triangle meshes. The core of the method is the <em>corefinement</em> technique,
of volumes bounded by triangle meshes and triangle soups. The core of the method is the <em>corefinement</em> technique,
which refines two meshes such that they become conformal.
This technique is re-used to also propose functions that enable trimming a mesh ("clipping")
and bisecting a mesh ("splitting") with a plane, a box, or another mesh.
Expand Down Expand Up @@ -145,7 +145,7 @@ possible, the input mesh will still be corefined.

If the input meshes contain triangles that are coplanar, it is guaranteed that the triangulations of those triangles
in the two corefined meshes will be identical. Also all edges of those refined triangles will be reported as intersection
edges (both in the function `CGAL::Polygon_mesh_processing::surface_intersection()` and in the named parameter
edges (both in the function `CGAL::Polygon_mesh_processing::intersection_polylines()` and in the named parameter
`edge_is_constrained_map()` of corefine prefixed functions).

\subsubsection coref_bolop_input_autorefsub Autorefinement
Expand All @@ -154,6 +154,22 @@ There is no restriction on the input for the function `CGAL::Polygon_mesh_proces
Degenerate triangles will be eliminated, duplicated points will be merged. If several triangles are coplanar,
the output will contain as many copies of the triangulation of those refined triangles.

\subsection tsoup_bolop_subsec Computing Boolean Operations on Triangle Soups
The Boolean operation functions based on corefine operate on triangle meshes. This data structure is not meant to
handle non-manifold edges. As it is sometime desirable to handle such cases, we also provide operations that are
taking as input triangle soups, representing possibly non-manifold volumes, and providing the result of a Boolean
operation as a triangle soup. In the following example, we use the function `CGAL::Polygon_mesh_processing::compute_difference()`
to iteratively subtract pieces of a puzzle.

\cgalFigureAnchor{nm_no_fig}
<center>
<img src="i_nm_bo.png" style="max-width:70%;"/>
</center>
\cgalFigureCaptionBegin{nm_no_fig}
Iterative subtraction of the pieces of a puzzle from David's torso. The result of the second operation is non-manifold and
so are all subsequent operations, until the last one.
\cgalFigureCaptionEnd


\subsection coref_valid_subsec Kernel Choice and Output Validity

Expand Down Expand Up @@ -323,5 +339,7 @@ The kernel functions and the specialization of clipping and plane refinement to
inputs were implemented in 2025 by Léo Valque, inspired by the work of Sorgente et al.
\cgalCite{sorgente2022polyhedron}.

The illustrations of the package pay homage to French sculptor and painter Sacha Sosno.

*/
} /* namespace CGAL */
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
/// Functions to corefine triangulated surface meshes and triangle soups.
/// \ingroup PkgPMPBooleanOperationsRef

/// \defgroup PMP_boolop_grp Boolean Operations
/// Functions to compute triangulated the union, difference, and intersection of meshes.
/// \defgroup PMP_boolop_grp Boolean Operations on Triangle Meshes
/// Functions to compute the union, difference, and intersection of triangle meshes.
/// \ingroup PkgPMPBooleanOperationsRef

/// \defgroup PMP_boolop_soup_grp Boolean Operations on Triangle Soups
/// Functions to compute triangulated the union, difference, and intersection of triangle soups (possibly non-manifold).
/// \ingroup PkgPMPBooleanOperationsRef

/// \defgroup PMP_clip_grp Clipping and Splitting
Expand Down Expand Up @@ -66,6 +70,11 @@ The page \ref bgl_namedparameters "Named Parameters" describes their usage.
- `CGAL::Polygon_mesh_processing::surface_intersection()` (deprecated)
- `CGAL::Polygon_mesh_processing::intersection_polylines()`

\cgalCRPSection{General Boolean Operations}
- `CGAL::Polygon_mesh_processing::compute_union()`
- `CGAL::Polygon_mesh_processing::compute_difference()`
- `CGAL::Polygon_mesh_processing::compute_intersection()`

\cgalCRPSection{Clipping and Splitting}
- `CGAL::Polygon_mesh_processing::clip()`
- `CGAL::Polygon_mesh_processing::split()`
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ create_single_source_cgal_program("corefinement_mesh_union_with_attributes.cpp")
create_single_source_cgal_program("corefinement_polyhedron_union.cpp")
create_single_source_cgal_program("corefinement_LCC.cpp")
create_single_source_cgal_program("soup_autorefinement.cpp")
create_single_source_cgal_program("soup_union.cpp")
create_single_source_cgal_program("surface_mesh_intersection.cpp")
create_single_source_cgal_program("triangle_mesh_autorefinement.cpp")
create_single_source_cgal_program("snap_polygon_soup.cpp")
Expand Down Expand Up @@ -49,6 +50,7 @@ find_package(TBB QUIET)
include(CGAL_TBB_support)
if(TARGET CGAL::TBB_support)
target_link_libraries(soup_autorefinement PRIVATE CGAL::TBB_support)
target_link_libraries(soup_union PRIVATE CGAL::TBB_support)
target_link_libraries(snap_polygon_soup PRIVATE CGAL::TBB_support)

create_single_source_cgal_program("corefinement_parallel_union_meshes.cpp")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>

#include <CGAL/Polygon_mesh_processing/triangle_soup_boolean_operations_3.h>
#include <CGAL/IO/polygon_soup_io.h>

#include <iostream>
#include <string>
#include <vector>

typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef K::Point_3 Point;

namespace PMP = CGAL::Polygon_mesh_processing;

int main(int argc, char* argv[])
{
const std::string filename1 =
(argc > 1) ? argv[1] : CGAL::data_file_path("meshes/blobby.off");
const std::string filename2 =
(argc > 2) ? argv[2] : CGAL::data_file_path("meshes/eight.off");

std::vector<Point> points1, points2;
std::vector<std::array<std::size_t, 3>> triangles1, triangles2;

if(!CGAL::IO::read_polygon_soup(filename1, points1, triangles1))
{
std::cerr << "Failed to read file: " << filename1 << std::endl;
return 1;
}

if(!CGAL::IO::read_polygon_soup(filename2, points2, triangles2))
{
std::cerr << "Failed to read file: " << filename2 << std::endl;
return 1;
}

std::vector<Point> points_output;
std::vector<std::array<std::size_t, 3>> triangles_output;

PMP::compute_union(points1, triangles1,
points2, triangles2,
points_output, triangles_output,
CGAL::parameters::concurrency_tag(CGAL::Parallel_if_available_tag()));

std::cout << "Union was successfully computed\n";

CGAL::IO::write_polygon_soup(
"union.off", points_output, triangles_output,
CGAL::parameters::stream_precision(17));

return 0;
}
Loading
Loading