Convertor from 3-Block Representation Representation to Vertices-Faces
Converts a polyhedron from the three-block representation to the vertices-faces representation.
M by 3 matrix containing the XYZ coordinates of vertex 1 of the M faces of the polyhedron
M by 3 matrix containing the XYZ coordinates of vertex 2 of the M faces of the polyhedron
M by 3 matrix containing the XYZ coordinates of vertex 3 of the M faces of the polyhedron
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
Vertices. Each row in this matrix defines a triangular face in the polyhedron.
This function is the inverse of the
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.
This function requires the misc3d library.
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[] block2 = blocks[] block3 = blocks[] # 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[] faces2 = vertsFaces[]
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.