| Title: | Fast 3D Alpha Hull with Label Propagation |
|---|---|
| Description: | Fast 3D alpha shape (alpha hull) computation with label propagation from input points to hull vertices and faces. Uses 'CGAL' for robust geometric computations. Optimized for Light Detection and Ranging ('LiDAR') processing and tree segmentation workflows. The implementation follows the alpha shape algorithm described in Edelsbrunner et al. (1983) <doi:10.1007/BF02579193>. |
| Authors: | Gergo Dioszegi [aut, cre, cph] (ORCID: <https://orcid.org/0009-0003-3454-9093>) |
| Maintainer: | Gergo Dioszegi <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-07-17 07:46:41 UTC |
| Source: | https://github.com/dijog/ahull3d |
Computes the alpha hull (alpha shape) of a 3D point cloud with optional label propagation for point classification.
ahull3D(points, alpha, input_truth = NULL, volume = FALSE)ahull3D(points, alpha, input_truth = NULL, volume = FALSE)
points |
Nx3 matrix of points |
alpha |
Alpha value (radius parameter) |
input_truth |
Optional labels (point id) for each input point |
volume |
Compute volume (default: FALSE) |
A mesh object (from rgl::tmesh3d) with attributes:
- input_truth: Propagated labels
- face_truth: Labels for each face
- alpha: Alpha value used
- volume: Volume (if requested)
Edelsbrunner, H., Kirkpatrick, D., & Seidel, R. (1983). On the shape of a set of points in the plane. IEEE Transactions on Information Theory, 29(4), 551-559. <doi:10.1007/BF02579193>
# Small example for testing # Generate random points on a sphere pts <- matrix(rnorm(100), ncol = 3) pts <- pts / sqrt(rowSums(pts^2)) # Compute alpha hull mesh <- ahull3D(pts, alpha = 0.5) # Visualize library(rgl) shade3d(mesh, col = "lightblue") # Larger example with visualization (may take longer) pts <- matrix(rnorm(300), ncol = 3) pts <- pts / sqrt(rowSums(pts^2)) mesh <- ahull3D(pts, alpha = 0.5) # Visualize library(rgl) shade3d(mesh, col = "lightblue") # Example with labels pts <- matrix(rnorm(60), ncol = 3) pts <- pts / sqrt(rowSums(pts^2)) labels <- rep(1:2, each = 10) mesh_labeled <- ahull3D(pts, alpha = 0.5, input_truth = labels) attr(mesh_labeled, "input_truth") # Compute volume mesh_vol <- ahull3D(pts, alpha = 0.8, volume = TRUE) attr(mesh_vol, "volume")# Small example for testing # Generate random points on a sphere pts <- matrix(rnorm(100), ncol = 3) pts <- pts / sqrt(rowSums(pts^2)) # Compute alpha hull mesh <- ahull3D(pts, alpha = 0.5) # Visualize library(rgl) shade3d(mesh, col = "lightblue") # Larger example with visualization (may take longer) pts <- matrix(rnorm(300), ncol = 3) pts <- pts / sqrt(rowSums(pts^2)) mesh <- ahull3D(pts, alpha = 0.5) # Visualize library(rgl) shade3d(mesh, col = "lightblue") # Example with labels pts <- matrix(rnorm(60), ncol = 3) pts <- pts / sqrt(rowSums(pts^2)) labels <- rep(1:2, each = 10) mesh_labeled <- ahull3D(pts, alpha = 0.5, input_truth = labels) attr(mesh_labeled, "input_truth") # Compute volume mesh_vol <- ahull3D(pts, alpha = 0.8, volume = TRUE) attr(mesh_vol, "volume")