class_docstr: A series of possibly disconnected, possibly closed, line and curve
  segments.
  
  The underlying storage is made up of two parallel numpy arrays:
  
  - *vertices*: an (N, 2) float array of vertices
  - *codes*: an N-length `numpy.uint8` array of path codes, or None
  
  These two arrays always have the same length in the first
  dimension.  For example, to represent a cubic curve, you must
  provide three vertices and three `CURVE4` codes.
  
  The code types are:
  
  - `STOP`   :  1 vertex (ignored)
      A marker for the end of the entire path (currently not required and
      ignored)
  
  - `MOVETO` :  1 vertex
      Pick up the pen and move to the given vertex.
  
  - `LINETO` :  1 vertex
      Draw a line from the current position to the given vertex.
  
  - `CURVE3` :  1 control point, 1 endpoint
      Draw a quadratic Bézier curve from the current position, with the given
      control point, to the given end point.
  
  - `CURVE4` :  2 control points, 1 endpoint
      Draw a cubic Bézier curve from the current position, with the given
      control points, to the given end point.
  
  - `CLOSEPOLY` : 1 vertex (ignored)
      Draw a line segment to the start point of the current polyline.
  
  If *codes* is None, it is interpreted as a `MOVETO` followed by a series
  of `LINETO`.
  
  Users of Path objects should not access the vertices and codes arrays
  directly.  Instead, they should use `iter_segments` or `cleaned` to get the
  vertex/code pairs.  This helps, in particular, to consistently handle the
  case of *codes* being None.
  
  Some behavior of Path objects can be controlled by rcParams. See the
  rcParams whose keys start with 'path.'.
  
  .. note::
  
      The vertices and codes arrays should be treated as
      immutable -- there are a number of optimizations and assumptions
      made up front in the constructor that will not change when the
      data changes.
docstr: Iterate over all curve segments in the path.
  
  Each iteration returns a pair ``(vertices, code)``, where ``vertices``
  is a sequence of 1-3 coordinate pairs, and ``code`` is a `Path` code.
  
  Additionally, this method can provide a number of standard cleanups and
  conversions to the path.
  
  Parameters
  ----------
  transform : None or :class:`~matplotlib.transforms.Transform`
      If not None, the given affine transformation will be applied to the
      path.
  remove_nans : bool, optional
      Whether to remove all NaNs from the path and skip over them using
      MOVETO commands.
  clip : None or (float, float, float, float), optional
      If not None, must be a four-tuple (x1, y1, x2, y2)
      defining a rectangle in which to clip the path.
  snap : None or bool, optional
      If True, snap all nodes to pixels; if False, don't snap them.
      If None, snap if the path contains only segments
      parallel to the x or y axes, and no more than 1024 of them.
  stroke_width : float, optional
      The width of the stroke being drawn (used for path snapping).
  simplify : None or bool, optional
      Whether to simplify the path by removing vertices
      that do not affect its appearance.  If None, use the
      :attr:`should_simplify` attribute.  See also :rc:`path.simplify`
      and :rc:`path.simplify_threshold`.
  curves : bool, optional
      If True, curve segments will be returned as curve segments.
      If False, all curves will be converted to line segments.
  sketch : None or sequence, optional
      If not None, must be a 3-tuple of the form
      (scale, length, randomness), representing the sketch parameters.
docstr_tok: ["Iterate","over","all","curve","segments","in","the","path",".","Each","iteration","returns","a","pair","``","(","vertices",",","code",")","``",",","where","``","vertices","``","is","a","sequence","of","1-3","coordinate","pairs",",","and","``","code","``","is","a","`","Path","`","code",".","Additionally",",","this","method","can","provide","a","number","of","standard","cleanups","and","conversions","to","the","path",".","Parameters","--","--","--","--","--","transform",":","None","or",":","class",":","`","~matplotlib.transforms.Transform","`","If","not","None",",","the","given","affine","transformation","will","be","applied","to","the","path",".","remove_nans",":","bool",",","optional","Whether","to","remove","all","NaNs","from","the","path","and","skip","over","them","using","MOVETO","commands",".","clip",":","None","or","(","float",",","float",",","float",",","float",")",",","optional","If","not","None",",","must","be","a","four-tuple","(","x1",",","y1",",","x2",",","y2",")","defining","a","rectangle","in","which","to","clip","the","path",".","snap",":","None","or","bool",",","optional","If","True",",","snap","all","nodes","to","pixels",";","if","False",",","do","n't","snap","them",".","If","None",",","snap","if","the","path","contains","only","segments","parallel","to","the","x","or","y","axes",",","and","no","more","than","1024","of","them",".","stroke_width",":","float",",","optional","The","width","of","the","stroke","being","drawn","(","used","for","path","snapping",")",".","simplify",":","None","or","bool",",","optional","Whether","to","simplify","the","path","by","removing","vertices","that","do","not","affect","its","appearance",".","If","None",",","use","the",":","attr",":","`","should_simplify","`","attribute",".","See","also",":","rc",":","`","path.simplify","`","and",":","rc",":","`","path.simplify_threshold","`",".","curves",":","bool",",","optional","If","True",",","curve","segments","will","be","returned","as","curve","segments",".","If","False",",","all","curves","will","be","converted","to","line","segments",".","sketch",":","None","or","sequence",",","optional","If","not","None",",","must","be","a","3-tuple","of","the","form","(","scale",",","length",",","randomness",")",",","representing","the","sketch","parameters","."]
code: def iter_segments(
      self,
      transform=None,
      remove_nans=True,
      clip=None,
      snap=False,
      stroke_width=1.0,
      simplify=None,
      curves=True,
      sketch=None,
  ):
      """
      Iterate over all curve segments in the path.
  
      Each iteration returns a pair ``(vertices, code)``, where ``vertices``
      is a sequence of 1-3 coordinate pairs, and ``code`` is a `Path` code.
  
      Additionally, this method can provide a number of standard cleanups and
      conversions to the path.
  
      Parameters
      ----------
      transform : None or :class:`~matplotlib.transforms.Transform`
          If not None, the given affine transformation will be applied to the
          path.
      remove_nans : bool, optional
          Whether to remove all NaNs from the path and skip over them using
          MOVETO commands.
      clip : None or (float, float, float, float), optional
          If not None, must be a four-tuple (x1, y1, x2, y2)
          defining a rectangle in which to clip the path.
      snap : None or bool, optional
          If True, snap all nodes to pixels; if False, don't snap them.
          If None, snap if the path contains only segments
          parallel to the x or y axes, and no more than 1024 of them.
      stroke_width : float, optional
          The width of the stroke being drawn (used for path snapping).
      simplify : None or bool, optional
          Whether to simplify the path by removing vertices
          that do not affect its appearance.  If None, use the
          :attr:`should_simplify` attribute.  See also :rc:`path.simplify`
          and :rc:`path.simplify_threshold`.
      curves : bool, optional
          If True, curve segments will be returned as curve segments.
          If False, all curves will be converted to line segments.
      sketch : None or sequence, optional
          If not None, must be a 3-tuple of the form
          (scale, length, randomness), representing the sketch parameters.
      """
      if not len(self):
          return
  
      cleaned = self.cleaned(
          transform=transform,
          remove_nans=remove_nans,
          clip=clip,
          snap=snap,
          stroke_width=stroke_width,
          simplify=simplify,
          curves=curves,
          sketch=sketch,
      )
  
      # Cache these object lookups for performance in the loop.
      NUM_VERTICES_FOR_CODE = self.NUM_VERTICES_FOR_CODE
      STOP = self.STOP
  
      vertices = iter(cleaned.vertices)
      codes = iter(cleaned.codes)
      for curr_vertices, code in zip(vertices, codes):
          if code == STOP:
              break
          extra_vertices = NUM_VERTICES_FOR_CODE[code] - 1
          if extra_vertices:
              for i in range(extra_vertices):
                  next(codes)
                  curr_vertices = np.append(
                      curr_vertices, next(vertices)
                  )
          yield curr_vertices, code
  
imports: import copy
  from functools import lru_cache
  from weakref import WeakValueDictionary
  import numpy
  import matplotlib
  from .None import _api, _path
  from .cbook import _to_unmasked_float_array, simple_linear_interpolation
  from .bezier import BezierSegment
label_desc: Use image node_id 20 for calling the Path obj's underlying member method code with example usage: obj.iter_segments(transform, remove_nans, clip, snap, stroke_width, simplify, curves, sketch) without return types