
Last chance! 50% off unlimited learning
Sale ends in
rgl.select3d(button = c("left", "middle", "right"))
select3d(...)
rgl.select3d
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.If the scene is later moved or rotated, the selected region will remain the same, no longer corresponding to a rectangle on the screen.
locator
# 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()
keep <- f(x,y,z)
rgl.pop()
points3d(x[keep],y[keep],z[keep],color='red')
points3d(x[!keep],y[!keep],z[!keep])
}
Run the code above in your browser using DataLab