vf2blocks {ptinpoly}R Documentation

Convertor from Vertices-Faces Representation to 3-Block Representation

Description

Converts a polyhedron from the vertices-faces representation to the three-block representation.

Usage

vf2blocks(Vertices,Faces)

Arguments

Vertices

N by 3 matrix containing the XYZ coordinates of N vertices

Faces

M by 3 matrix containing indices of vertices defining M faces

Details

The values in the Face matrix must be integers with values running from 1 to N, where N is the number of vertices. A value of '1' in this matrix, for example, represents the 1st vertex, i.e., the vertex defined by the first row in the matrix Vertices.

This function is the inverse of the blocks2vf function.

Value

Returns a list of three matrices. The first is an M by 3 matrix containing the XYZ coordinates of vertex 1 of the M faces of the polyhedron. The second and third are similarly M by 3 matrices, but contain the XYZ coordinates of vertices 2 and 3 of the faces. See the example below.

Examples

# Load example data.
data(verts)
data(faces)

# Use vf2blocks to convert from vertices-faces representation to 3-block representation.
# Note double square brackets.
blocks = vf2blocks(verts,faces)
block1 = blocks[[1]]
block2 = blocks[[2]]
block3 = blocks[[3]]

[Package ptinpoly version 2.8 Index]