ashape3d {alphashape3d} | R Documentation |
3D \alpha
-shape computation
Description
This function calculates the 3D \alpha
-shape of a given sample of
points in the three-dimensional space for \alpha>0
.
Usage
ashape3d(x, alpha, pert = FALSE, eps = 1e-09)
Arguments
x |
A 3-column matrix with the coordinates of the input points.
Alternatively, an object of class "ashape3d" can be provided, see
Details.
|
alpha |
A single value or vector of values for \alpha .
|
pert |
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.
|
eps |
Scaling factor used for data perturbation when the input points
are not in general position, see Details.
|
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)
.
Value
An object of class "ashape3d"
with the following components
(see Edelsbrunner and Mucke (1994) for notation):
tetra |
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
\alpha -complex (column 5) and for each \alpha a value (1 or 0)
indicating whether the tetrahedron belongs to the \alpha -shape
(columns 6 to last).
|
triang |
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
\alpha -complex (columns 6 to 8) and for each \alpha a value (0,
1, 2 or 3) indicating, respectively, that the triangle is not in the
\alpha -shape or it is interior, regular or singular (columns 9 to
last). As defined in Edelsbrunner and Mucke (1994), a simplex in the
\alpha -complex is interior if it does not belong to the boundary of
the \alpha -shape. A simplex in the \alpha -complex is regular if
it is part of the boundary of the \alpha -shape and bounds some
higher-dimensional simplex in the \alpha -complex. A simplex in the
\alpha -complex is singular if it is part of the boundary of the
\alpha -shape but does not bounds any higher-dimensional simplex in the
\alpha -complex.
|
edge |
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
\alpha -complex (columns 5 to 7) and for each \alpha a value (0,
1, 2 or 3) indicating, respectively, that the edge is not in the
\alpha -shape or it is interior, regular or singular (columns 8 to
last).
|
vertex |
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 \alpha -complex (columns 3 and 4) and
for each \alpha a value (1, 2 or 3) indicating, respectively, if the
point is interior, regular or singular (columns 5 to last).
|
x |
A
3-column matrix with the coordinates of the original sample points.
|
alpha |
A single value or vector of values of \alpha .
|
xpert |
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).
|
References
Edelsbrunner, H., Mucke, E. P. (1994). Three-Dimensional Alpha
Shapes. ACM Transactions on Graphics, 13(1), pp.43-72.
Examples
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)
[Package
alphashape3d version 1.3.2
Index]