Processing of 3D surface meshes based on the 'C++' library 'CGAL' (Computational Geometry Algorithms Library, < https://www.cgal.org/>). Reads and writes common file formats for meshes and polygon soups. Supports mesh repair, remeshing, subdivision, Boolean operations on bounded volumes, outlier removal, surface reconstruction, (optimal) bounding box, bounding sphere, bounding ellipsoid, convex hull, vertex normals, surface distance metrics (such as Hausdorff), volume-overlap similarity measures JSC (Jaccard Similarity Coefficient) and DSC (Dice Similarity Coefficient). Adapts code from packages 'Boov' and 'cgalMeshes' developed by Stephane Laurent.
CGALSurfaceMesh is an R package that supports processing of 3D surface meshes using as backend the C++ library CGAL for computational geometry via R package RcppCGAL. Features:
mesh3d from package rgl, also compatible with package RvcgThe package also calculates distance and similarity metrics for a given pair of 3D surface meshes (see dkfz metrics reloaded):
See package Rmpfr for a note on how to install system requirements MPFR and GMP.
This package includes code adapted from packages Boov, cgalMeshes, and SurfaceReconstruction developed and copyright by Stéphane Laurent. Currently, only a subset of the functionality of these packages is provided in SurfaceMesh.
A fork / adaptation of packages Boov, cgalMeshes, and SurfaceReconstruction was carried out as upstream changes to CGAL introduced incompatibilities, and the packages were archived from CRAN.
The design was chosen such that mesh data resides in R space. This means that for each mesh operation, data is first transferred to the C++ side (using Rcpp), converted to a CGAL surface mesh, processed with CGAL functions, and then transferred back to R. The package does not maintain a pointer to a C++ data structure to keep the mesh data there - unlike packages such as terra or cgalMeshes. This approach carries a performance penalty, but from an R perspective, it is more straightforward. In particular, there are no serialization issues (saving meshes). Furthermore, memory management is easier.
This package is provided under the GPL-3 license, but it uses the C++ library CGAL. To use CGAL for commercial purposes, you must obtain a license from the GeometryFactory.