class_docstr: Define basic tools for triangular mesh analysis and improvement.
  
  A TriAnalizer encapsulates a :class:`~matplotlib.tri.Triangulation`
  object and provides basic tools for mesh analysis and mesh improvement.
  
  Parameters
  ----------
  triangulation : :class:`~matplotlib.tri.Triangulation` object
      The encapsulated triangulation to analyze.
  
  Attributes
  ----------
  `scale_factors`
class_docstr_tok: ["Define","basic","tools","for","triangular","mesh","analysis","and","improvement",".","A","TriAnalizer","encapsulates","a",":","class",":","`","~matplotlib.tri.Triangulation","`","object","and","provides","basic","tools","for","mesh","analysis","and","mesh","improvement",".","Parameters","--","--","--","--","--","triangulation",":",":","class",":","`","~matplotlib.tri.Triangulation","`","object","The","encapsulated","triangulation","to","analyze",".","Attributes","--","--","--","--","--","`","scale_factors","`"]
docstr: Returns 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 :attr:`scale_factors` (Only if *rescale* is True, which is
  its default value).
  
  Parameters
  ----------
  rescale : boolean, optional
      If True, a rescaling will be internally performed (based on
      :attr:`scale_factors`, so that the (unmasked) triangles fit
      exactly inside a unit square mesh. Default is True.
  
  Returns
  -------
  circle_ratios : 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.
docstr_tok: ["Returns","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",":","attr",":","`","scale_factors","`","(","Only","if","*","rescale","*","is","True",",","which","is","its","default","value",")",".","Parameters","--","--","--","--","--","rescale",":","boolean",",","optional","If","True",",","a","rescaling","will","be","internally","performed","(","based","on",":","attr",":","`","scale_factors","`",",","so","that","the","(","unmasked",")","triangles","fit","exactly","inside","a","unit","square","mesh",".","Default","is","True",".","Returns","--","--","--","-","circle_ratios",":","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):
      """
      Returns 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 :attr:`scale_factors` (Only if *rescale* is True, which is
      its default value).
  
      Parameters
      ----------
      rescale : boolean, optional
          If True, a rescaling will be internally performed (based on
          :attr:`scale_factors`, so that the (unmasked) triangles fit
          exactly inside a unit square mesh. Default is True.
  
      Returns
      -------
      circle_ratios : 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.sqrt(a[:, 0] ** 2 + a[:, 1] ** 2)
      b = np.sqrt(b[:, 0] ** 2 + b[:, 1] ** 2)
      c = np.sqrt(c[:, 0] ** 2 + c[:, 1] ** 2)
      # 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/py2/matplotlib/tri/tritools.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  from matplotlib.tri import Triangulation
  import numpy
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