vf2blocks: Convertor from Vertices-Faces Representation to 3-Block...

Description Usage Arguments Details Value Examples

View source: R/vf2blocks.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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]]

ptinpoly documentation built on May 31, 2020, 3 p.m.

Related to vf2blocks in ptinpoly...