select3d

0th

Percentile

Select a rectangle in an RGL scene

This function allows the user to use the mouse to select a region in an RGL scene.

Keywords
dynamic
Usage
rgl.select3d(button = c("left", "middle", "right"),
             dev = rgl.cur(), subscene = currentSubscene3d(dev))
select3d(...)
Arguments
button

Which button to use for selection.

dev, subscene

The rgl device and subscene to work with

...

Button argument to pass to rgl.select3d

Details

This function selects 3-dimensional regions by allowing the user to use a mouse to draw a rectangle showing the projection of the region onto the screen. It returns a function which tests points for inclusion in the selected region.

If the scene is later moved or rotated, the selected region will remain the same, no longer corresponding to a rectangle on the screen.

Value

Returns a function f(x, y, z) which tests whether each of the points (x, y, z) is in the selected region, returning a logical vector. This function accepts input in a wide variety of formats as it uses xyz.coords to interpret its parameters.

See Also

selectpoints3d, locator

Aliases
  • select3d
  • rgl.select3d
Examples
# NOT RUN {
# Allow the user to select some points, and then redraw them
# in a different color

if (interactive()) {
 x <- rnorm(1000)
 y <- rnorm(1000)
 z <- rnorm(1000)
 open3d()
 points3d(x, y, z)
 f <- select3d()
 if (!is.null(f)) {
   keep <- f(x, y, z)
   rgl.pop()
   points3d(x[keep], y[keep], z[keep], color = 'red')
   points3d(x[!keep], y[!keep], z[!keep])
 }
}
# }
Documentation reproduced from package rgl, version 0.100.50, License: GPL

Community examples

Looks like there are no examples yet.