qmesh3d                 package:rgl                 R Documentation

_3_D _Q_u_a_d_r_a_n_g_l_e _M_e_s_h _o_b_j_e_c_t_s

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

     3D Quadrangle Mesh object creation and a collection of sample
     objects.

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

       qmesh3d(vertices, indices, homogeneous = TRUE, material = NULL)
       cube3d(trans = identityMatrix(), ...)  # cube object
       oh3d(trans = identityMatrix(), ...)    # an 'o' object
       
       dot3d(x, ...)   # draw dots at the vertices of an object
       ## S3 method for class 'qmesh3d':
       dot3d(x, override = TRUE, ...)
       wire3d(x, ...)  # draw a wireframe object
       ## S3 method for class 'qmesh3d':
       wire3d(x, override = TRUE, ...)
       shade3d(x, ...) # draw a shaded object
       ## S3 method for class 'qmesh3d':
       shade3d(x, override = TRUE, ...)

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

       x: a qmesh3d object (class qmesh3d)

vertices: 3- or 4-component vector of coordinates

 indices: 4-component vector of quad indices

homogeneous: logical indicating if homogeneous (four component)
          coordinates are used.

material: material properties for later rendering

   trans: transformation to apply to objects; see below for defaults

     ...: additional rendering parameters

override: should the parameters specified here override those stored in
          the object?

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

     The 'cube3d' and 'oh3d' objects optionally take a matrix
     transformation as  an argument.  This transformation is applied to
     all vertices of the default shape.

     The default is an identity transformation.  Use
     'par3d("userMatrix")' to render the object vertically in the
     current user view.

_V_a_l_u_e:

     'qmesh3d', 'cube3d', and 'oh3d' return 'qmesh3d' objects.

     'dot3d', 'wire3d', and 'shade3d' are called for their side effect
     of drawing an object into the scene; they return an object ID.

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

     'r3d', 'par3d'

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

       # generate a quad mesh object

       vertices <- c( 
          -1.0, -1.0, 0, 1.0,
           1.0, -1.0, 0, 1.0,
           1.0,  1.0, 0, 1.0,
          -1.0,  1.0, 0, 1.0
       )
       indices <- c( 1, 2, 3, 4 )
       
       open3d()  
       wire3d( qmesh3d(vertices,indices) )
       
       # render 4 meshes vertically in the current view

       open3d()  
       bg3d("gray")
       l0 <- oh3d(tran = par3d("userMatrix"), color = "green" )
       shade3d( translate3d( l0, -6, 0, 0 ))
       l1 <- subdivision3d( l0 )
       shade3d( translate3d( l1 , -2, 0, 0 ), color="red", override = FALSE )
       l2 <- subdivision3d( l1 )
       shade3d( translate3d( l2 , 2, 0, 0 ), color="red", override = TRUE )
       l3 <- subdivision3d( l2 )
       shade3d( translate3d( l3 , 6, 0, 0 ), color="red" )
       

