r3d                   package:rgl                   R Documentation

_G_e_n_e_r_i_c _3_D _i_n_t_e_r_f_a_c_e

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

     Generic 3D interface for 3D rendering and computational geometry.

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

     R3d is a design for an interface for 3d rendering and computation
     without dependency on a specific rendering implementation. R3d
     includes a collection of 3D objects and geometry algorithms. All
     r3d interface functions are named '*3d'.  They represent generic
     functions that delegate  to implementation functions.

     The interface can be grouped into 8 categories: Scene Management,
     Primitive Shapes, High-level Shapes, Geometry Objects,
     Visualization, Interaction, Transformation, Subdivision.  

     The rendering interface gives an abstraction to the underlying
     rendering model. It can be grouped into four categories:    

   _S_c_e_n_e _M_a_n_a_g_e_m_e_n_t: A 3D scene consists of shapes, lights and
        background environment. 

   _P_r_i_m_i_t_i_v_e _S_h_a_p_e_s: Generic primitive 3D graphics shapes such as
        points, lines, triangles, quadrangles and texts. 

   _H_i_g_h-_l_e_v_e_l _S_h_a_p_e_s: Generic high-level 3D graphics shapes such as
        spheres, sprites and terrain.

   _I_n_t_e_r_a_c_t_i_o_n: Generic interface to select points in 3D space using
        the pointer device.

     In this package we include an implementation of r3d using the
     underlying 'rgl.*' functions.

     3D computation is supported through the use of object structures
     that live entirely in R.

   _G_e_o_m_e_t_r_y _O_b_j_e_c_t_s: Geometry and mesh objects allow to define
        high-level geometry for computational purpose such as
        quadrangle meshes (qmesh3d).

   _T_r_a_n_s_f_o_r_m_a_t_i_o_n: Generic interface to transform 3d objects.

   _V_i_s_u_a_l_i_z_a_t_i_o_n: Generic rendering of 3d objects such as dotted, wired
        or shaded.

   _C_o_m_p_u_t_a_t_i_o_n: Generic subdivision of 3d objects.

     At present, there are two main practical differences between the
     r3d functions and the 'rgl.*' functions is that the r3d functions
     call 'open3d' if there is no device open, and the 'rgl.*'
     functions call 'rgl.open'. By default 'open3d' sets the initial
     orientation of the coordinate system in 'world coordinates', i.e.
     a right-handed coordinate system in which the x-axis
     increasingfrom left to right, the y-axis increases with depth into
     the scene, and the z-axis increases from bottom to top of the
     screen.  'rgl.*' functions, on the other hand, use a right-handed
     coordinate system similar to that used in OpenGL.  The x-axis
     matches that of r3d, but the y-axis increases from bottom to top,
     and the z-axis decreases with depth into the scene.  Since the
     user can manipulate the scene, either system can be rotated into
     the other one.  

     The r3d functions also preserve the 'rgl.material' setting across
     calls (except for texture elements, in the current
     implementation), whereas the 'rgl.*' functions leave it as set by
     the last call.

     The example code below illustrates the two coordinate systems.

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

     'points3d' 'lines3d' 'segments3d' 'triangles3d' 'quads3d' 'text3d'
     'spheres3d' 'sprites3d' 'terrain3d' 'select3d' 'dot3d' 'wire3d'
     'shade3d' 'transform3d' 'rotate3d' 'subdivision3d' 'qmesh3d'
     'cube3d' 'rgl'

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

         
          x <- c(0,1,0,0)
          y <- c(0,0,1,0)
          z <- c(0,0,0,1)
          labels <- c("Origin", "X", "Y", "Z")
          i <- c(1,2,1,3,1,4)

          rgl.open()
          rgl.texts(x,y,z,labels)
          rgl.texts(1,1,1,"rgl.* coordinates")
          rgl.lines(x[i],y[i],z[i])

          open3d()
          text3d(x,y,z,labels)
          text3d(1,1,1,"*3d coordinates")
          segments3d(x[i],y[i],z[i])

