Clear the current rgl device or open a new one (if there are no devices or
if open = TRUE).
Arguments
- open
if
TRUEa new rgl device is opened.- clear
rgl stack(s) to remove, see argument
typeinrgl::clear3d()(used only if there is an active device andopen = FALSE). Defaults to"all", with a new light source added to the scene.- ...
additional arguments, passed to
rgl::open3d()orrgl::clear3d().
Value
Called for its side effect (opens or clears the rgl device, and configures the mouse mode); invisibly returns the current device.
Details
In addition, new3d() changes several of the default mouse actions in rgl,
assigning the middle button to zoom (via setmouse3d()), the right button
to pan (via pan3d()), and enabling a double-click with the left button to
restore the scene's default viewpoint (via dbltrack3d(); keeping the mouse
acting as a virtual trackball, rotating the scene, when this button is held down).
Examples
library(rgl)
# New rgl device
new3d()
shade3d(volcanom, col = "lightgreen")
# Use the right mouse button to panning,
# the middle button (or wheel) to zoom,
# rotate as usual with left button; double-click resets the view
# NOTE: these mouse actions currently **do not work with RMarkdown** documents.
# ...
# Clear the current device
new3d()
sshade3d(volcanom, s = volcanom$vb[3, ], meshColor = "facesvertices",
col = terrain.colors(128))
3D plot