class_docstr: Class for storing and operating on 3D mesh data. May contain:
  
    - list of vertex locations
    - list of edges
    - list of triangles
    - colors per vertex, edge, or tri
    - normals per vertex or tri
  
  This class handles conversion between the standard [list of vertexes, list of faces]
  format (suitable for use with glDrawElements) and 'indexed' [list of vertexes] format
  (suitable for use with glDrawArrays). It will automatically compute face normal
  vectors as well as averaged vertex normal vectors. 
  
  The class attempts to be as efficient as possible in caching conversion results and
  avoiding unnecessary conversions.
class_docstr_tok: ["Class","for","storing","and","operating","on","3D","mesh","data",".","May","contain",":","-","list","of","vertex","locations","-","list","of","edges","-","list","of","triangles","-","colors","per","vertex",",","edge",",","or","tri","-","normals","per","vertex","or","tri","This","class","handles","conversion","between","the","standard","[","list","of","vertexes",",","list","of","faces","]","format","(","suitable","for","use","with","glDrawElements",")","and","'indexed","'","[","list","of","vertexes","]","format","(","suitable","for","use","with","glDrawArrays",")",".","It","will","automatically","compute","face","normal","vectors","as","well","as","averaged","vertex","normal","vectors",".","The","class","attempts","to","be","as","efficient","as","possible","in","caching","conversion","results","and","avoiding","unnecessary","conversions","."]
docstr: Return a MeshData instance with vertexes and faces computed
  for a cylindrical surface.
  The cylinder may be tapered with different radii at each end (truncated cone)
docstr_tok: ["Return","a","MeshData","instance","with","vertexes","and","faces","computed","for","a","cylindrical","surface",".","The","cylinder","may","be","tapered","with","different","radii","at","each","end","(","truncated","cone",")"]
code: def cylinder(rows, cols, radius=[1.0, 1.0], length=1.0, offset=False):
      """
      Return a MeshData instance with vertexes and faces computed
      for a cylindrical surface.
      The cylinder may be tapered with different radii at each end (truncated cone)
      """
      verts = np.empty((rows + 1, cols, 3), dtype=float)
      if isinstance(radius, int):
          radius = [radius, radius]  # convert to list
      ## compute vertexes
      th = np.linspace(2 * np.pi, (2 * np.pi) / cols, cols).reshape(
          1, cols
      )
      r = np.linspace(
          radius[0], radius[1], num=rows + 1, endpoint=True
      ).reshape(
          rows + 1, 1
      )  # radius as a function of z
      verts[..., 2] = np.linspace(
          0, length, num=rows + 1, endpoint=True
      ).reshape(
          rows + 1, 1
      )  # z
      if offset:
          th = th + (
              (np.pi / cols) * np.arange(rows + 1).reshape(rows + 1, 1)
          )  ## rotate each row by 1/2 column
      verts[..., 0] = r * np.cos(th)  # x = r cos(th)
      verts[..., 1] = r * np.sin(th)  # y = r sin(th)
      verts = verts.reshape(
          (rows + 1) * cols, 3
      )  # just reshape: no redundant vertices...
      ## compute faces
      faces = np.empty((rows * cols * 2, 3), dtype=np.uint)
      rowtemplate1 = (
          (np.arange(cols).reshape(cols, 1) + np.array([[0, 1, 0]]))
          % cols
      ) + np.array([[0, 0, cols]])
      rowtemplate2 = (
          (np.arange(cols).reshape(cols, 1) + np.array([[0, 1, 1]]))
          % cols
      ) + np.array([[cols, 0, cols]])
      for row in range(rows):
          start = row * cols * 2
          faces[start : start + cols] = rowtemplate1 + row * cols
          faces[start + cols : start + (cols * 2)] = (
              rowtemplate2 + row * cols
          )
  
      return MeshData(vertexes=verts, faces=faces)
  
imports: import numpy
  from ..Qt import QtGui
label_desc: Use image node_id 26 for calling the MeshData obj's underlying member method code with example usage: obj.cylinder(rows, cols, radius, length, offset) and returns: MeshData