MeshesDifference | R Documentation |
Computes the difference between two meshes.
MeshesDifference( mesh1, mesh2, clean = FALSE, normals = FALSE, numbersType = "double" )
mesh1, mesh2 |
two meshes, each being either a
rgl mesh, or as a list with (at least) two fields:
|
clean |
Boolean, whether to clean the input mesh (merging duplicated vertices, duplicated faces, removing 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 triangle mesh given as a list with fields vertices
,
faces
, edges
, exteriorEdges
, gmpvertices
if numbersType="gmp"
, and normals
if normals=TRUE
.
library(MeshesOperations) library(rgl) # mesh one: a cube cube1 <- cube3d() # (from the rgl package) mesh1 <- list(vertices = t(cube1[["vb"]][-4L, ]), faces = t(cube1[["ib"]])) # mesh two: another cube cube2 <- translate3d( # (from the rgl package) cube3d(), 1, 1, 0 ) mesh2 <- list(vertices = t(cube2[["vb"]][-4L, ]), faces = t(cube2[["ib"]])) # compute the difference differ <- MeshesDifference(mesh1, mesh2) # plot rgldiffer <- toRGL(differ) open3d(windowRect = c(50, 50, 562, 562)) shade3d(cube1, color = "yellow", alpha = 0.2) shade3d(cube2, color = "cyan", alpha = 0.2) shade3d(rgldiffer, color = "red") plotEdges( vertices = differ[["vertices"]], edges = differ[["exteriorEdges"]], edgesAsTubes = TRUE, verticesAsSpheres = TRUE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.