class_docstr: Define basic tools for triangular mesh analysis and improvement.
  
  A TriAnalyzer encapsulates a `.Triangulation` object and provides basic
  tools for mesh analysis and mesh improvement.
  
  Attributes
  ----------
  scale_factors
  
  Parameters
  ----------
  triangulation : `~matplotlib.tri.Triangulation`
      The encapsulated triangulation to analyze.
docstr: Return a measure of the triangulation triangles flatness.
  
  The ratio of the incircle radius over the circumcircle radius is a
  widely used indicator of a triangle flatness.
  It is always ``<= 0.5`` and ``== 0.5`` only for equilateral
  triangles. Circle ratios below 0.01 denote very flat triangles.
  
  To avoid unduly low values due to a difference of scale between the 2
  axis, the triangular mesh can first be rescaled to fit inside a unit
  square with `scale_factors` (Only if *rescale* is True, which is
  its default value).
  
  Parameters
  ----------
  rescale : bool, default: True
      If True, internally rescale (based on `scale_factors`), so that the
      (unmasked) triangles fit exactly inside a unit square mesh.
  
  Returns
  -------
  masked array
      Ratio of the incircle radius over the circumcircle radius, for
      each 'rescaled' triangle of the encapsulated triangulation.
      Values corresponding to masked triangles are masked out.
code: def circle_ratios(self, rescale=True):
      """
      Return a measure of the triangulation triangles flatness.
  
      The ratio of the incircle radius over the circumcircle radius is a
      widely used indicator of a triangle flatness.
      It is always ``<= 0.5`` and ``== 0.5`` only for equilateral
      triangles. Circle ratios below 0.01 denote very flat triangles.
  
      To avoid unduly low values due to a difference of scale between the 2
      axis, the triangular mesh can first be rescaled to fit inside a unit
      square with `scale_factors` (Only if *rescale* is True, which is
      its default value).
  
      Parameters
      ----------
      rescale : bool, default: True
          If True, internally rescale (based on `scale_factors`), so that the
          (unmasked) triangles fit exactly inside a unit square mesh.
  
      Returns
      -------
      masked array
          Ratio of the incircle radius over the circumcircle radius, for
          each 'rescaled' triangle of the encapsulated triangulation.
          Values corresponding to masked triangles are masked out.
  
      """
      # Coords rescaling
      if rescale:
          (kx, ky) = self.scale_factors
      else:
          (kx, ky) = (1.0, 1.0)
      pts = np.vstack(
          [self._triangulation.x * kx, self._triangulation.y * ky]
      ).T
      tri_pts = pts[self._triangulation.triangles]
      # Computes the 3 side lengths
      a = tri_pts[:, 1, :] - tri_pts[:, 0, :]
      b = tri_pts[:, 2, :] - tri_pts[:, 1, :]
      c = tri_pts[:, 0, :] - tri_pts[:, 2, :]
      a = np.hypot(a[:, 0], a[:, 1])
      b = np.hypot(b[:, 0], b[:, 1])
      c = np.hypot(c[:, 0], c[:, 1])
      # circumcircle and incircle radii
      s = (a + b + c) * 0.5
      prod = s * (a + b - s) * (a + c - s) * (b + c - s)
      # We have to deal with flat triangles with infinite circum_radius
      bool_flat = prod == 0.0
      if np.any(bool_flat):
          # Pathologic flow
          ntri = tri_pts.shape[0]
          circum_radius = np.empty(ntri, dtype=np.float64)
          circum_radius[bool_flat] = np.inf
          abc = a * b * c
          circum_radius[~bool_flat] = abc[~bool_flat] / (
              4.0 * np.sqrt(prod[~bool_flat])
          )
      else:
          # Normal optimized flow
          circum_radius = (a * b * c) / (4.0 * np.sqrt(prod))
      in_radius = (a * b * c) / (4.0 * circum_radius * s)
      circle_ratio = in_radius / circum_radius
      mask = self._triangulation.mask
      if mask is None:
          return circle_ratio
      else:
          return np.ma.array(circle_ratio, mask=mask)
  
file_path: catboost/contrib/python/matplotlib/py3/matplotlib/tri/_tritools.py
imports: import numpy
  from matplotlib import _api
  from matplotlib.tri import Triangulation
label_desc: Use image node_id 3 for calling the TriAnalyzer obj's underlying member method code with example usage: obj.circle_ratios(rescale) and returns: circle_ratio, np