inashape3d: Test of the inside of an alpha-shape

inashape3dR Documentation

Test of the inside of an α-shape

Description

This function checks whether points are inside an α-shape.

Usage

inashape3d(as3d, indexAlpha = 1, points)

Arguments

as3d

An object of class "ashape3d" that represents the α-shape of a given sample of points in the three-dimensional space, see ashape3d.

indexAlpha

A single value or vector with the indexes of as3d$alpha that should be used for the computation, see Details.

points

A 3-column matrix with the coordinates of the input points.

Details

The function inashape3d checks whether each point in points is inside the α-shape for each value of α in as3d$alpha[indexAlpha].

If indexAlpha="all" or indexAlpha="ALL" then the function checks whether each point in points is inside the α-shape for all values of α in as3d$alpha.

Value

If indexAlpha is a single value then the function returns a vector of boolean of length the number of input points. The element at position i is TRUE if the point in points[i,] is inside the α-shape.

Otherwise inashape3d returns a list of vectors of boolean values (each object in the list as described above).

See Also

ashape3d

Examples


T1 <- rtorus(2000, 0.5, 2)
T2 <- rtorus(2000, 0.5, 2, ct = c(2, 0, 0), rotx = pi/2)
x <- rbind(T1, T2)
ashape3d.obj <- ashape3d(x, alpha = 0.4)
# Random sample of points in a plane
points <- matrix(c(5*runif(10000) - 2.5, rep(0.01, 5000)), nc = 3)
in3d <- inashape3d(ashape3d.obj, points = points)
plot(ashape3d.obj, transparency = 0.2)
colors <- ifelse(in3d, "blue", "green")
points3d(points, col = colors)


alphashape3d documentation built on Feb. 16, 2023, 8:12 p.m.