| plotEdges | R Documentation |
Plot the given edges with rgl.
plotEdges( vertices, edges, color = "black", lwd = 2, edgesAsTubes = TRUE, tubesRadius = 0.03, verticesAsSpheres = TRUE, only = NULL, 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 |
only |
integer vector made of the indices of the vertices you want
to plot (as spheres), or |
spheresRadius |
the radius of the spheres when
|
spheresColor |
the color of the spheres when
|
No value.
library(PolygonSoup)
library(rgl)
# we triangulate the truncated icosahedron mesh
mesh <- Mesh(
mesh = truncatedIcosahedron,
triangulate = TRUE, normals = FALSE
)
# now we can plot the truncated icosahedron
tmesh <- toRGL(mesh)
open3d(windowRect = c(50, 50, 562, 562), zoom = 0.9)
shade3d(tmesh, color = "gold")
# we plot the edges given in `mesh[["edges0"]]`; these are the
# edges of the mesh before the triangulation
plotEdges(mesh[["vertices"]], mesh[["edges0"]], color = "navy")
# we triangulate the pentagrammic prism mesh
mesh <- Mesh(
mesh = pentagrammicPrism,
triangulate = TRUE, normals = FALSE
)
# now we can plot the pentagrammic prism
tmesh <- toRGL(mesh)
open3d(windowRect = c(50, 50, 562, 562), zoom = 0.9)
shade3d(tmesh, color = "navy")
# we plot the exterior edges only, given in `mesh[["exteriorEdges"]]`
plotEdges(
mesh[["vertices"]], mesh[["exteriorEdges"]], color = "gold",
tubesRadius = 0.02, spheresRadius = 0.02
)
# or only plot the edges whose corresponding dihedral angle is acute:
allEdges <- mesh[["edgesDF"]]
edges <- as.matrix(subset(allEdges, angle <= 91, select = c("i1", "i2")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.