optimal | R Documentation |
This function simply returns the given integer with a special
class; it is intended to be used in the alpha
argument of the
setAlpha
function to compute and set the optimal value of
alpha for which the alpha hull has no more than n
connected
components.
optimal(n)
n |
a non-negative integer, the maximal number of connected components of the alpha hull |
The value is the input integer n
with a special class.
library(AlphaHull3D) library(uniformly) # sample some points in a torus ans some points in a sphere: set.seed(666L) pts_torus <- runif_in_torus(1000L, R = 3, r = 1) pts_sphere <- runif_in_sphere(1000L, d = 3L, r = 1) # shift the points in the sphere: pts_sphere <- sweep(pts_sphere, 2L, c(0, 0, 2), FUN = "+") # full alpha hull: ahull <- fullAhull3d(rbind(pts_torus, pts_sphere)) # set optimal alpha for 2 connected components: mesh <- setAlpha(ahull, alpha = optimal(2)) # plot: library(rgl) open3d(windowRect = c(50, 50, 562, 562)) shade3d(mesh, color = "yellow")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.