Foreword: The Boolean operation interface vtkBooleanOperationFilter or other interfaces provided by vtk are unstable and slow; this blog post mainly uses the CGAL library to optimize Boolean operations, and I hope to help you guys!
CAGL open source library
introduce
CGAL is a software project that provides easy access to efficient and reliable geometric algorithms in the form of a C++ library. CGAL is used in various fields requiring geometric calculations, such as geographic information systems, computer-aided design, molecular biology, medical imaging, computer graphics, and robotics.
The library provides data structures and algorithms such as triangulation , Voronoi diagrams , Boolean operations on polygons and polyhedra , point set processing, curve alignment , surface and volume mesh generation , geometry processing , alpha shapes, convex hull algorithms , shape reconstruction , AABB and KD trees ...
To learn more about CGAL, browse the package overview .
Download & compile Example
Using source code compilation [CGAL] Installation and compilation of CGAL-5.2.1 (Win10+vs2019+CGAL-5.2.1)_cgal gmp_Flying Tyrannosaurus Rex Blog-CSDN Blog
VS&QT runs the Triangulation_2 sample
Encounter problems
1. Error: The number of sections exceeds the object file format limit: please use bigobj to compile
operating environment | solution |
VS&QT | Open the item's 属性页 dialog box Click C/C++ Item. Click 命令行 Property Pages. Type the compiler option in the box and add it. 其他选项 /bigobj |
QT | QMAKE_CXXFLAGS += /bigobj |
2. Error: error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ) already in msvcprtd Defined in .lib(MSVCP120D.dll)
Solution: Remove the Boost library
3. 错误:Impossible to draw, CGAL_USE_BASIC_VIEWER is not defined.
Solution: pending
Environment configuration
Additional include directories: $(SolutionDir)ThirdRepository\CGAL-5.5.2\auxiliary\gmp\include;$(SolutionDir)ThirdRepository\CGAL-5.5.2\include;$(SolutionDir)ThirdRepository\CGAL-5.5.2\boost_1_71_0;
Additional library path: $(SolutionDir)ThirdRepository\CGAL-5.5.2\auxiliary\gmp\lib;
Add libraries: libgmp-10.lib; libmpfr-4.lib;
VS&QT runs the Triangulation_2 sample
reference
VTK Learning Thirty - vtkPolyData to CGAL Surface_mesh_vtkpolygon_wblong_cs' Blog - CSDN Blog
reference documents
Problems with VTK Boolean operations:
VTK-vtkIntersectionPolyDataFilter_Xueyi's Blog-CSDN Blog
VTK - Boolean Boolean operation_vtkimplicitboolean_Xueyi's Blog-CSDN Blog
Boolean open source library comparison:
3D Mesh Boolean Open Source Library_Shihuashan's Blog-CSDN Blog
CGAL open source library download: