class_docstr: Polygon class for data handling
  
  Parameters
  ----------
  vertices : (Nv, 3) array
      Vertex coordinates. If faces is not specified, then this will instead
      be interpreted as (Nf, 3, 3) array of coordinates.
  edges : (Nv, 2) array
      Constraining edges specified by vertex indices.
  faces : (Nf, 3) array
      Indexes into the vertex array.
  
  Notes
  -----
  All arguments are optional.
docstr: Triangulates the set of vertices and stores the triangles in faces and
  the convex hull in convex_hull.
docstr_tok: ["Triangulates","the","set","of","vertices","and","stores","the","triangles","in","faces","and","the","convex","hull","in","convex_hull","."]
code: def triangulate(self):
      """
      Triangulates the set of vertices and stores the triangles in faces and
      the convex hull in convex_hull.
      """
      npts = self._vertices.shape[0]
      if np.any(self._vertices[0] != self._vertices[1]):
          # start != end, so edges must wrap around to beginning.
          edges = np.empty((npts, 2), dtype=np.uint32)
          edges[:, 0] = np.arange(npts)
          edges[:, 1] = edges[:, 0] + 1
          edges[-1, 1] = 0
      else:
          # start == end; no wrapping required.
          edges = np.empty((npts - 1, 2), dtype=np.uint32)
          edges[:, 0] = np.arange(npts)
          edges[:, 1] = edges[:, 0] + 1
  
      tri = Triangulation(self._vertices, edges)
      tri.triangulate()
      return tri.pts, tri.tris
  
file_path: vispy/vispy/geometry/polygon.py
imports: import numpy
  from .triangulation import Triangulation
label_desc: Use image node_id 9 for calling the PolygonData obj's underlying member method code with example usage: obj.triangulate() and returns: tri,  tri