surfaceTriangles           package:misc3d           R Documentation

_C_r_e_a_t_e _a _T_r_i_a_n_g_l_e _M_e_s_h _R_e_p_r_e_s_e_n_t_i_n_g _a _S_u_r_f_a_c_e

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

     Creates a triangle mesh object representing a surface over a
     rectangular grid.

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

     surfaceTriangles(x, y, f, color = "red", color2 = NA, alpha = 1,
                      fill = TRUE, col.mesh = if (fill) NA else color,
                      smooth = 0, material = "default")

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

    x, y: numeric vectors.

       f: numeric matrix of dimension 'length(x)' by 'length(y)' or
          vectorized function of two arguments.

   color: color to use for the surface. Can also be a function of three
          arguments.  This is called with three arguments, the
          coordinates of the midpoints of the triangles making up the
          surface. The function should return a vector of colors to use
          for the triangles.

  color2: opposite face color; only used for "standard" and "grid"
          engines.

   alpha: alpha channel level, a number between 0 and 1..

    fill: logical; if 'TRUE', drawing should use filled surfaces;
          otherwise a wire frame should be drawn.

col.mesh: color to use for the wire frame.

  smooth: integer specifying Phong shading level; currently only used
          by "standard" and "grid" engines.

material: material specification; currently only used by "standard" and
          "grid" engines.  Currently possible values are the character
          strings "dull", "shiny", "metal", and "default".

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

     Returns a triangle mesh object representing the surface.

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

     'persp', 'rgl.surface', 'surface3d'.

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

       drawScene(surfaceTriangles(seq(-1,1,len=30), seq(-1,1,len=30),
                                  function(x, y) (x^2 + y^2), color2 = "green"))

