scene {rgl} | R Documentation

## scene management

### Description

Clear shapes, lights, bbox

### Usage

    clear3d( type = c("shapes", "bboxdeco", "material"), defaults, subscene = 0 )
    rgl.clear( type = "shapes", subscene = 0 )
    pop3d( ... )
    rgl.pop( type = "shapes", id = 0 )
    rgl.ids( type = "shapes", subscene = NA )

### Arguments

`type`

Select subtype(s):

"shapes"

  shape stack

"lights"

  light stack

"bboxdeco"

  bounding box

"userviewpoint"

  user viewpoint

"modelviewpoint"

  model viewpoint

"material"

  material properties

"background"

  scene background

"subscene"

  subscene list

"all"

  all of the above

`defaults` | default values to use after clearing
`subscene` | which subscene to work with. `NA` means the current one, `0` means the whole scene
`id` | vector of ID numbers of items to remove
`...` | generic arguments passed through to RGL-specific (or other) functions

### Details

RGL holds several lists of objects in each scene. There are lists for shapes, lights, bounding box decorations, subscenes, etc. `clear3d` and `rgl.clear` clear the specified stack, or restore the defaults for the bounding box (not visible) or viewpoint. With `id = 0` `rgl.pop` removes the last added node on the list (except for subscenes: there it removes the active subscene). The `id` argument may be used to specify arbitrary item(s) to remove; if `id != 0`, the `type` argument is ignored.

`rgl.clear` and `clear3d` may also be used to clear material properties back to their defaults.

`clear3d` has an optional `defaults` argument, which defaults to `r3dDefaults`. Only the `materials` component of this argument is currently used by `clear3d`.

`rgl.ids` returns a dataframe containing the IDs in the currently active subscene by default, or a specified subscene, or if `subscene = 0`, in the whole rgl window, along with an indicator of their type.

Note that clearing the light stack leaves the scene in darkness; it should normally be followed by a call to `rgl.light` or `light3d`.

### See Also

`rgl`, `rgl.bbox`, `rgl.light`, `open3d` to open a new window.

### Examples

      x <- rnorm(100)
      y <- rnorm(100)
      z <- rnorm(100)
      p <- plot3d(x, y, z, type = 's')
      rgl.ids()
      lines3d(x, y, z)
      rgl.ids()
      if (interactive() && !rgl.useNULL()) {
        readline("Hit enter to change spheres")
        rgl.pop(id = p["data"])
        spheres3d(x, y, z, col = "red", radius = 1/5)
        box3d()
      }

[Package rgl version 0.98.1 Index]