plotEdges | R Documentation |
Plot the given edges with rgl.
plotEdges(
vertices,
edges,
color = "black",
lwd = 2,
edgesAsTubes = TRUE,
tubesRadius = 0.03,
verticesAsSpheres = TRUE,
spheresRadius = 0.05,
spheresColor = color
)
vertices |
a three-columns matrix giving the coordinates of the vertices |
edges |
a two-columns integer matrix giving the edges by pairs of vertex indices |
color |
a color for the edges |
lwd |
line width, a positive number, ignored if |
edgesAsTubes |
Boolean, whether to draw the edges as tubes |
tubesRadius |
the radius of the tubes when |
verticesAsSpheres |
Boolean, whether to draw the vertices as spheres |
spheresRadius |
the radius of the spheres when
|
spheresColor |
the color of the spheres when
|
No value, just produces a 3D graphic.
library(cgalMeshes)
library(rgl)
mesh <- cgalMesh$new(pentagrammicPrism, clean = FALSE)
vertices <- mesh$getVertices()
edges <- mesh$getEdges()
extEdges <- exteriorEdges(edges)
tmesh <- mesh$triangulate()$getMesh()
open3d(windowRect = 50 + c(0, 0, 512, 512), zoom = 0.9)
shade3d(tmesh, color = "navy")
# we plot the exterior edges only
plotEdges(
vertices, extEdges, color = "gold",
tubesRadius = 0.02, spheresRadius = 0.02
)
# or only plot the edges whose corresponding dihedral angle is acute:
sharpEdges <- as.matrix(subset(edges, angle <= 91, select = c("i1", "i2")))
open3d(windowRect = 50 + c(0, 0, 512, 512), zoom = 0.9)
shade3d(tmesh, color = "maroon")
plotEdges(
vertices, sharpEdges, color = "darkred",
tubesRadius = 0.02, spheresRadius = 0.02
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.