
Last chance! 50% off unlimited learning
Sale ends in
This function calculates the 3D
ashape3d(x, alpha, pert = FALSE, eps = 1e-09)
An object of class "ashape3d"
with the following components
(see Edelsbrunner and Mucke (1994) for notation):
For each
tetrahedron of the 3D Delaunay triangulation, the matrix tetra
stores
the indices of the sample points defining the tetrahedron (columns 1 to 4),
a value that defines the intervals for which the tetrahedron belongs to the
For each triangle of the 3D Delaunay
triangulation, the matrix triang
stores the indices of the sample
points defining the triangle (columns 1 to 3), a value (1 or 0) indicating
whether the triangle is on the convex hull (column 4), a value (1 or 0)
indicating whether the triangle is attached or unattached (column 5), values
that define the intervals for which the triangle belongs to the
For each edge of the 3D Delaunay
triangulation, the matrix edge
stores the indices of the sample
points defining the edge (columns 1 and 2), a value (1 or 0) indicating
whether the edge is on the convex hull (column 3), a value (1 or 0)
indicating whether the edge is attached or unattached (column 4), values
that define the intervals for which the edge belongs to the
For each sample point, the matrix vertex
stores
the index of the point (column 1), a value (1 or 0) indicating whether the
point is on the convex hull (column 2), values that define the intervals for
which the point belongs to the
A 3-column matrix with the coordinates of the original sample points.
A single value or vector of values of
A 3-column matrix with the coordinates of the perturbated
sample points (only when the input points are not in general position and
pert
is set to TRUE).
A 3-column matrix with the coordinates of the input points.
Alternatively, an object of class "ashape3d"
can be provided, see
Details.
A single value or vector of values for
Logical. If the input points are not in general position and
pert
it set to TRUE the observations are perturbed by adding random
noise, see Details.
Scaling factor used for data perturbation when the input points are not in general position, see Details.
If x
is an object of class "ashape3d"
, then ashape3d
does not recompute the 3D Delaunay triangulation (it reduces the
computational cost).
If the input points x
are not in general position and pert
is
set to TRUE, the function adds random noise to the data. The noise is
generated from a normal distribution with mean zero and standard deviation
eps*sd(x)
.
Edelsbrunner, H., Mucke, E. P. (1994). Three-Dimensional Alpha Shapes. ACM Transactions on Graphics, 13(1), pp.43-72.
T1 <- rtorus(1000, 0.5, 2)
T2 <- rtorus(1000, 0.5, 2, ct = c(2, 0, 0), rotx = pi/2)
x <- rbind(T1, T2)
# Value of alpha
alpha <- 0.25
# 3D alpha-shape
ashape3d.obj <- ashape3d(x, alpha = alpha)
plot(ashape3d.obj)
# For new values of alpha, we can use ashape3d.obj as input (faster)
alpha <- c(0.15, 1)
ashape3d.obj <- ashape3d(ashape3d.obj, alpha = alpha)
plot(ashape3d.obj, indexAlpha = 2:3)
Run the code above in your browser using DataLab