alphashape3d (version 1.3)

plot.ashape3d: Plot the \(\alpha\)-shape in 3D

Description

This function plots the \(\alpha\)-shape in 3D using the package rgl.

Usage

# S3 method for ashape3d
plot(x, clear = TRUE, col = c(2, 2, 2),
  byComponents = FALSE, indexAlpha = 1, transparency = 1,
  walpha = FALSE, triangles = TRUE, edges = TRUE, vertices = TRUE, ...)

Arguments

x

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

clear

Logical, specifying whether the current rgl device should be cleared.

col

A vector of length three specifying the colors of the triangles, edges and vertices composing the \(\alpha\)-shape, respectively.

byComponents

Logical, if TRUE the connected components of the \(\alpha\)-shape are represented in different colors, see components_ashape3d.

indexAlpha

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

transparency

The coefficient of transparency, from 0 (transparent) to 1 (opaque), used to plot the \(\alpha\)-shape.

walpha

Logical, if TRUE the value of \(\alpha\) is displayed in the rgl device.

triangles

Logical, if TRUE triangles are plotted.

edges

Logical, if TRUE edges are plotted.

vertices

Logical, if TRUE vertices are plotted.

Material properties. See rgl.material for details.

Details

The function plot.ashape3d opens a rgl device for each value of \(\alpha\) in x$alpha[indexAlpha]. Device information is displayed in the console.

If indexAlpha="all" or indexAlpha="ALL" then the function represents the \(\alpha\)-shape for all values of \(\alpha\) in as3d$alpha.

See Also

ashape3d, components_ashape3d

Examples

Run this code
# NOT RUN {
T1 <- rtorus(1000, 0.5, 2)
T2 <- rtorus(1000, 0.5, 2, ct = c(2, 0, 0), rotx = pi/2)
x <- rbind(T1, T2)
alpha <- c(0.15, 0.25, 1)
ashape3d.obj <- ashape3d(x, alpha = alpha)

# Plot the alpha-shape for all values of alpha
plot(ashape3d.obj, indexAlpha = "all")

# Plot the connected components of the alpha-shape for alpha=0.25
plot(ashape3d.obj, byComponents = TRUE, indexAlpha = 2)

# }

Run the code above in your browser using DataCamp Workspace