# blocks2vf: Convertor from 3-Block Representation Representation to... In ptinpoly: Point-In-Polyhedron Test (2D and 3D)

## Description

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

## Usage

 `1` ```blocks2vf(Block1,Block2,Block3) ```

## Arguments

 `Block1` M by 3 matrix containing the XYZ coordinates of vertex 1 of the M faces of the polyhedron `Block2` M by 3 matrix containing the XYZ coordinates of vertex 2 of the M faces of the polyhedron `Block3` M by 3 matrix containing the XYZ coordinates of vertex 3 of the M faces of the polyhedron

## Details

The values in the first output matrix can be floating point integers, representing the XYZ coordinates of the vertices of the polyhedron.

The values in the second output matrix will 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`. Each row in this matrix defines a triangular face in the polyhedron.

This function is the inverse of the `vf2blocks` function.

## Value

Returns a list of two matrices. The first is a N by 3 matrix containing the XYZ coordinates of the N vertices of the polyhedron. The second M by 3 matrix containing indices of the vertices defining the M faces. See the example below.

## Note

This function requires the misc3d library.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18``` ```# 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]] # Now use blocks2vf to convert back to vertices-faces representation. # 'verts2' and 'faces2' should encode the same polyhedron as the # original 'verts' and 'faces', although perhaps in a different order. # Note double square brackets. vertsFaces = blocks2vf(block1,block2,block3) verts2 = vertsFaces[[1]] faces2 = vertsFaces[[2]] ```

ptinpoly documentation built on May 29, 2017, 1:08 p.m.