This method attempts to read the attributes of objects in the rgl display and construct a mesh3d object to approximate them.
A vector of rgl identifiers of objects in the specified subscene.
A vector of names of types of shapes to convert. Other shapes will be ignored.
Which subscene to look in; the default
This function attempts to construct a triangle mesh to approximate
one or more objects from the current display. It can only handle objects of types from
c("triangles", "quads", "planes", "surface").
Since this method only produces triangular meshes, they won't necessarily be an exact match to the original object.
If the generic
as.mesh3d is called with no
argument, this method will be called with
x set to the
ids in the current scene.
A triangular mesh object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# volcano example taken from "persp" # data(volcano) z <- 2 * volcano # Exaggerate the relief x <- 10 * (1:nrow(z)) # 10 meter spacing (S to N) y <- 10 * (1:ncol(z)) # 10 meter spacing (E to W) zlim <- range(y) zlen <- zlim - zlim + 1 colorlut <- terrain.colors(zlen) # height color lookup table col <- colorlut[ z - zlim + 1 ] # assign colors to heights for each point open3d(useNULL = TRUE) surface3d(x, y, z, color = col) m <- as.mesh3d() close3d() open3d() shade3d(m)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.