CGAL alternative for 3D Boolean Operations

In computational geometry and CAD modeling, selecting the right 3D boolean library is crucial for efficient and accurate operations. Two popular choices, MeshLib and CGAL, offer different strengths and weaknesses. This article compares their performance in real-world scenarios to help you make an informed decision.sculptures. Efficiency and accuracy are paramount in these applications.

In this article, we’ll compare the performance of different 3D boolean libraries under various scenarios to help you make an informed decision.

What is MeshLib?

MeshLib is an open-source 3D geometry library that allows effortless creation of powerful 3D applications and execution of advanced operations using either C++ or Python. With its user-friendly interface and extensive documentation, MeshLib boolean operations simplify complex geometric tasks for developers of all levels, making it a preferred choice across industries.

What is CGAL?

CGAL (The Computational Geometry Algorithms Library, or C GAL) is an open-source software library of computational geometry algorithms, primarily written in C++, with bindings available for Scilab, Python, and Java. It offers dual licensing, providing open-source licenses for use in open-source projects and commercial licenses for other applications. Known for its precision and efficiency, CGAL boolean operations are trusted by developers for handling complex geometric computations reliably.

MeshLib vs CGAL comparison table​

License

MeshLib

-

CGAL

Commercial

Nefertity-U

MeshLib

1.2 (1.4)

CGAL

7.5

Nefertity-I

MeshLib

0.7 (0.9)

CGAL

6.7

Nefertity-Dif

MeshLib

0.9 (1.1)

CGAL

7

MeshLib demonstrates significantly faster processing times compared to CGAL. For instance, MeshLib completes the union operation (U) in 1.2 units, while CGAL takes 7.5 units, indicating MeshLib’s superior efficiency in these operations.

Nefertity Copy U

MeshLib

7.3 (7.7)

CGAL

LGPL 3/Paid support180+hangs

MeshLib completes the union operation on copied meshes without any issues, whereas CGAL experiences hangs, indicating potential stability issues with CGAL in this scenario.

Nefertity Noise U

MeshLib

63

CGAL

N/D

MeshLib completes the union operation even when one mesh contains noise, while CGAL returns no data (N/D), suggesting limitations in handling noisy meshes.

Degen U

MeshLib

0.18 (0.21)

CGAL

1.6

Degen I

MeshLib

0.17 (0.20)

CGAL

1.6

Degen Dif

MeshLib

0.20 (0.22)

CGAL

1.7

MeshLib consistently outperforms CGAL in all degenerate mesh scenarios, with faster processing times and no crashes, indicating MeshLib’s robustness in handling complex geometries.

Holed Not Isec

MeshLib

YES

CGAL

YES

Holed Isec

MeshLib

NO

CGAL

NO

Holed Isec

MeshLib

NO

CGAL

NO

Both MeshLib and CGAL exhibit similar performance in scenarios involving holes and self-intersections, with no significant differences observed.

MeshLib vs CGAL comparison table

Library

Meshlib 2.4.0.85

CGAL

Comments

License

Commercial

Nefertity-U

1.2 (1.4)

7.5

Nefertity - I

0.7 (0.9)

6.7

Nefertity - Dif

0.9 (1.1)

7

MeshLib demonstrates significantly faster processing times compared to CGAL. For instance, MeshLib completes the union operation (U) in 1.2 units, while CGAL takes 7.5 units, indicating MeshLib’s superior efficiency in these operations.

Nefertity Copy U

7.3 (7.7)

LGPL 3/Paid support180+hangs

MeshLib completes the union operation on copied meshes without any issues, whereas CGAL experiences hangs, indicating potential stability issues with CGAL in this scenario.

Nefertity Noise U

63

N/D

MeshLib completes the union operation even when one mesh contains noise, while CGAL returns no data (N/D), suggesting limitations in handling noisy meshes.

Degen U

0.18 (0.21)

1.6

Degen I

0.17 (0.20)

1.6

Degen Dif

0.20 (0.22)

1.7

MeshLib consistently outperforms CGAL in all degenerate mesh scenarios, with faster processing times and no crashes, indicating MeshLib’s robustness in handling complex geometries.

Holed Not Isec

Yes

Yes

Holed Isec

No

No

Self Isec

No

No

Both MeshLib and CGAL exhibit similar performance in scenarios involving holes and self-intersections, with no significant differences observed.

Here is the link to the full table with a description of the methodology. This table includes detailed performance results for various scenarios, along with a description of the methodology used for testing.

In summary, while both MeshLib and CGAL offer robust solutions for 3D boolean operations, MeshLib demonstrates superior performance in most scenarios, with faster processing times and greater stability, particularly in handling complex or copied meshes. Developers may prefer MeshLib for its efficiency and reliability in real-world applications.

Play Video