MinkowskiSum | R Documentation |
Returns the mesh defined as the Minkowski sum of the two input meshes.
MinkowskiSum(mesh1, mesh2, triangulate = TRUE, normals = FALSE)
mesh1, mesh2 |
two meshes, each one given either as a list containing
(at least) the two fields |
triangulate |
Boolean, whether to triangulate the output mesh (note that it is not necessarily triangle when the two input meshes are triangle) |
normals |
Boolean, whether to compute the vertex normals of the output mesh |
A mesh represented as the output of the Mesh
function.
# example 1: octahedron + sphere library(MeshesOperations) library(rgl) mesh1 <- octahedron3d() mesh2 <- sphereMesh(iterations = 2L) mesh <- MinkowskiSum(mesh1, mesh2, normals = TRUE) rglmesh <- toRGL(mesh) open3d(windowRect = c(50, 50, 562, 562)) view3d(30, 30, zoom = 0.8) shade3d(rglmesh, color = "maroon") # example2: truncated icosahedron + tetrahedron library(MeshesOperations) library(rgl) # mesh 1 mesh1 <- truncatedIcosahedron # mesh 2: regular tetrahedron a <- 1 / sqrt(3) vertices <- rbind( c( a, -a, -a), c( a, a, a), c(-a, -a, a), c(-a, a, -a) ) faces <- rbind( c(1L, 2L, 3L), c(3L, 2L, 4L), c(4L, 2L, 1L), c(1L, 3L, 4L) ) mesh2 <- list(vertices = vertices, faces = faces) # sum mesh <- MinkowskiSum(mesh1, mesh2, normals = FALSE) # plot rglmesh <- toRGL(mesh) open3d(windowRect = c(50, 50, 562, 562)) view3d(30, 30, zoom = 0.8) shade3d(rglmesh, color = "navy") plotEdges(mesh[["vertices"]], mesh[["edges0"]], color = "yellow")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.