convexParts | R Documentation |
Decomposition of a mesh into convex parts.
convexParts(mesh, triangulate = TRUE)
mesh |
either a list containing the fields |
triangulate |
Boolean, whether to triangulate the convex parts |
A list of cgalMesh
lists (see
Mesh
), each corresponding to a convex part.
# a non-convex polyhedron #### library(MeshesTools) library(rgl) library(randomcoloR) meshes <- convexParts(mesh = NonConvexPolyhedron) ncp <- length(meshes) colors <- randomColor(ncp, hue = "random", luminosity = "bright") open3d(windowRect = c(50, 50, 562, 562), zoom = 0.8) for(i in seq_len(ncp)){ shade3d(toRGL(meshes[[i]]), color = colors[i]) } # pentagrammic prism #### library(MeshesTools) library(rgl) library(randomcoloR) data(pentagrammicPrism, package = "PolygonSoup") meshes <- convexParts(mesh = pentagrammicPrism) ncp <- length(meshes) colors <- randomColor(ncp, hue = "random", luminosity = "bright") open3d(windowRect = c(50, 50, 562, 562), zoom = 0.8) for(i in seq_len(ncp)){ shade3d(toRGL(meshes[[i]]), color = colors[i]) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.