| convexParts | R Documentation |
Decomposition of a mesh into convex parts.
convexParts(vertices, faces, mesh = NULL, triangulate = TRUE)
vertices |
a numeric matrix with three columns, or a |
faces |
either an integer matrix (each row provides the vertex indices of the corresponding face) or a list of integer vectors, each one providing the vertex indices of the corresponding face |
mesh |
if not |
triangulate |
Boolean, whether to triangulate the convex parts |
A list of cgalMesh lists, each corresponding to a convex part.
# a non-convex polyhedron ####
library(MeshesOperations)
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])
}
plotEdges(
NonConvexPolyhedron[["vertices"]],
NonConvexPolyhedron[["edges"]]
)
# pentagrammic prism ####
library(MeshesOperations)
library(rgl)
library(randomcoloR)
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])
}
plotEdges(
pentagrammicPrism[["vertices"]],
pentagrammicPrism[["edges"]],
tubesRadius = 0.01,
spheresRadius = 0.02
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.