MeshesUnion | R Documentation |
Computes the union of the given meshes.
MeshesUnion(meshes, clean = FALSE, normals = FALSE, numbersType = "double")
meshes |
a list of triangular meshes, each given as a list with
(at least) two fields: |
clean |
Boolean, whether to clean the input meshes (merging duplicated vertices, duplicated faces, removed isolated vertices) as well as the output mesh |
normals |
Boolean, whether to return the per-vertex normals of the output mesh |
numbersType |
the type of the numbers used in C++ for the
computations; must be one of |
A triangular mesh given as a list with fields vertices
,
faces
, edges
, exteriorEdges
, gmpvertices
if numberTypes="gmp"
, and normals
if normals=TRUE
.
library(RCGAL) library(rgl) # mesh one: a cube; one has to triangulate it cube1 <- cube3d() # (from the rgl package) vertices <- t(cube1$vb[-4L, ]) faces <- t(cube1$ib) mesh1 <- Mesh(vertices, faces, triangulate = TRUE, normals = FALSE) # mesh two: another cube; one also has to triangulate it cube2 <- translate3d( # (from the rgl package) cube3d(), 1, 1, 1 ) vertices <- t(cube2$vb[-4L, ]) faces <- t(cube2$ib) mesh2 <- Mesh(vertices, faces, triangulate = TRUE, normals = FALSE) # compute the union umesh <- MeshesUnion(list(mesh1, mesh2)) # plot rglumesh <- tmesh3d( vertices = t(umesh[["vertices"]]), indices = t(umesh[["faces"]]), homogeneous = FALSE ) open3d(windowRect = c(50, 50, 562, 562)) shade3d(rglumesh, color = "red") plotEdges( vertices = umesh[["vertices"]], edges = umesh[["exteriorEdges"]], edgesAsTubes = TRUE, verticesAsSpheres = TRUE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.