Description Usage Arguments Details Value Note See Also Examples
Draw scenes consisting of one or more surfaces described by triangular mesh data structures.
1 2 3 4 5 6 7 8 9 | drawScene(scene, light = c(0, 0, 1),
screen = list(z = 40, x = -60), scale = TRUE, R.mat = diag(4),
perspective = FALSE, distance = if (perspective) 0.2 else 0,
fill = TRUE, xlim = NULL, ylim = NULL, zlim = NULL,
aspect = c(1, 1), col.mesh = if (fill) NA else "black",
polynum = 100, lighting = phongLighting, add = FALSE,
engine = "standard", col.bg = "transparent", depth = 0,
newpage = TRUE)
drawScene.rgl(scene, add = FALSE, ...)
|
scene |
a triangle mesh object of class |
light |
numeric vector of length 3 or 4. The first three
elements represent the direction to the light in viewer coordinates;
the viewer is at |
screen |
as for |
scale |
logical. Before viewing the x, y and z coordinates of the
scene defining the surface are transformed to the interval
[-0.5,0.5]. If |
R.mat |
initial rotation matrix in homogeneous coordinates, to be
applied to the data before |
perspective |
logical, whether to render a perspective
view. Setting this to |
distance |
numeric, between 0 and 1, controls amount of
perspective. The distance of the viewing point from the origin (in
the transformed coordinate system) is |
fill |
logical; if |
xlim,ylim,zlim |
x-, y- and z-limits. The scene is rendered so that the rectangular volume defined by these limits is visible. |
aspect |
vector of length 2. Gives the relative aspects of the y-size/x-size and z-size/x-size of the enclosing cube. |
col.mesh |
color to use for the wire frame if |
polynum |
integer. Number of triangles to pass in batches to grid primitives for the "grid" engine. The default should be adequate. |
lighting |
a lighting function. Current options are
|
add |
logical; if |
engine |
character; currently "standard" or "grid". |
col.bg |
background dolor to use in color depth cuing. |
depth |
numeric, between 0 and 1. Controls the amount of color
blending to |
newpage |
logical; if |
... |
rgl material and texture properties; see documentation for
|
drawScene
renders a scene consisting of one or more triangle
mesh objects using standard or grid graphics. Object-specific
rendering features such as smoothing and material are controlled by
setting in the objects. Arguments to drawScene
control global
factors such as viewer and light position.
drawScene.rgl
renders the scene in an rgl window.
If add=TRUE
in standard or grid graphics then coordinates are
not further scaled after the transformations implied by R.mat
,
and distance
are applied. For the grid engine drawing occurs
in the current viewport.
drawScene.rgl
returns NULL
. The return value of
drawScene
is the viewing transformation as returned by
persp
.
The "rgl" engine now uses the standard rgl coordinates instead of
negating y
and swapping y
and z
. If you need to
reproduce the previous behavior you can use
options(old.misc3d.orientation=TRUE)
.
Transparency only works properly in the "rgl" engine. For standard or grid graphics on devices that support transparency using alpha levels less than 1 does work but the triangle borders show as a less transparent mesh.
1 2 3 4 5 6 7 8 9 10 11 12 | vtri <- local({
z <- 2 * volcano
x <- 10 * (1:nrow(z))
y <- 10 * (1:ncol(z))
surfaceTriangles(x, y, z, color="green3")
})
drawScene(vtri, scale = FALSE)
drawScene(vtri, screen=list(x=40, y=-40, z=-135), scale = FALSE)
drawScene(vtri, screen=list(x=40, y=-40, z=-135), scale = FALSE,
perspective = TRUE)
drawScene(vtri, screen=list(x=40, y=-40, z=-135), scale = FALSE,
perspective = TRUE, depth = 0.4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.