scene                  package:rgl                  R Documentation

_s_c_e_n_e _m_a_n_a_g_e_m_e_n_t

_D_e_s_c_r_i_p_t_i_o_n:

     Clear shapes, lights, bbox

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

    type: Select subtype(s):

          "_s_h_a_p_e_s" shape stack

          "_l_i_g_h_t_s" light stack

          "_b_b_o_x_d_e_c_o" bounding box

          "_v_i_e_w_p_o_i_n_t" viewpoint

          "_m_a_t_e_r_i_a_l" material properties

          "_a_l_l" all of the above

defaults: default values to use after clearing

      id: vector of ID numbers of items to remove

     ...: generic arguments passed through to RGL-specific (or other)
          functions

_D_e_t_a_i_l_s:

     RGL holds two stacks. One is for shapes and the other is for
     lights.  'clear3d' and 'rgl.clear' clear the specified stack, or
     restore the defaults for the bounding box (not visible) or
     viewpoint.  By default with 'id=0' 'rgl.pop' removes  the top-most
     (last added) node on the shape stack.  The 'id' argument may be
     used to specify arbitrary item(s) to remove from the specified
     stack.

     '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 rgl window, along with an indicator of their type.

     For convenience, 'type="shapes"' and  'id=1' signifies the
     bounding box.

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

_S_e_e _A_l_s_o:

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

_E_x_a_m_p_l_e_s:

       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()) {
         readline("Hit enter to change spheres")
         rgl.pop(id = p[c("data", "box.lines")])
         spheres3d(x, y, z, col="red", radius=1/5)
         box3d()
       }

