Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

inashape3d

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

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")
rgl.points(points, col = colors)

alphashape3d

Implementation of the 3D Alpha-Shape for the Reconstruction of 3D Sets from a Point Cloud

v1.3.1
GPL-2
Authors
Thomas Lafarge, Beatriz Pateiro-Lopez
Initial release
2020-12-09

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.