Learn R Programming

alphashape3d (version 1.3.2)

surfaceNormals: Normal vectors computation

Description

This function calculates the normal vectors of all the triangles which belong to the boundary of the \(\alpha\)-shape.

Usage

surfaceNormals(x, indexAlpha = 1, display = FALSE, col = 3, scale = 1,
  ...)

Value

If indexAlpha is a single value then the function returns an object of class "normals" with the following components:

normals

Three-column matrix with the euclidean coordinates of the normal vectors.

centers

Three-column matrix with the euclidean coordinates of the centers of the triangles that form the \(\alpha\)-shape.

Otherwise surfaceNormals returns a list of class "normals-List" (each object in the list as described above).

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.

indexAlpha

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

display

Logical, if TRUE, surfaceNormals open a new rgl device and display the related \(\alpha\)-shape and its normals vectors.

col

Color of the normal vectors.

scale

Scale parameter to control the length of the surface normals, only affect display.

...

Material properties. See material3d for details.

Details

The function surfaceNormals computes the normal vectors of all the triangles which belong to the boundary of the \(\alpha\)-shape for each value of \(\alpha\) in x$alpha[indexAlpha]. The magnitude of each vector is equal to the area of its associated triangle.

If indexAlpha="all" or indexAlpha="ALL" then the function computes the normal vectors for all values of \(\alpha\) in as3d$alpha.

See Also

ashape3d

Examples

Run this code

x <- rtorus(1000, 0.5, 1)
alpha <- 0.25
ashape3d.obj <- ashape3d(x, alpha = alpha)
surfaceNormals(ashape3d.obj, display = TRUE)

Run the code above in your browser using DataLab