library(MeshesOperations)
library(rgl)
# mesh one: a cube
mesh1 <- cube3d() # (from the rgl package)
# mesh two: another cube
mesh2 <- translate3d( # (from the rgl package)
cube3d(), 1, 1, 1
)
# compute the union
umesh <- MeshesUnion(list(mesh1, mesh2))
# plot
rglumesh <- toRGL(umesh)
open3d(windowRect = c(50, 50, 562, 562))
shade3d(rglumesh, color = "red")
plotEdges(
vertices = umesh[["vertices"]], edges = umesh[["exteriorEdges"]],
edgesAsTubes = TRUE, verticesAsSpheres = TRUE
)
Run the code above in your browser using DataLab