classmatplotlib.tri.TriAnalyzer(triangulation)[source]
 
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.  Parameters 
 
triangulationTriangulation


The encapsulated triangulation to analyze.    Attributes 
 scale_factors

Factors to rescale the triangulation into a unit square.       circle_ratios(rescale=True)[source]
 
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 
 
rescalebool, 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.     
   get_flat_tri_mask(min_circle_ratio=0.01, rescale=True)[source]
 
Eliminate excessively flat border triangles from the triangulation. Returns a mask new_mask which allows to clean the encapsulated triangulation from its border-located flat triangles (according to their circle_ratios()). This mask is meant to be subsequently applied to the triangulation using Triangulation.set_mask. new_mask is an extension of the initial triangulation mask in the sense that an initially masked triangle will remain masked. The new_mask array is computed recursively; at each step flat triangles are removed only if they share a side with the current mesh border. Thus no new holes in the triangulated domain will be created.  Parameters 
 
min_circle_ratiofloat, default: 0.01


Border triangles with incircle/circumcircle radii ratio r/R will be removed if r/R < min_circle_ratio.  
rescalebool, default: True


If True, first, internally rescale (based on scale_factors) so that the (unmasked) triangles fit exactly inside a unit square mesh. This rescaling accounts for the difference of scale which might exist between the 2 axis.    Returns 
 array of bool

Mask to apply to encapsulated triangulation. All the initially masked triangles remain masked in the new_mask.     Notes The rationale behind this function is that a Delaunay triangulation - of an unstructured set of points - sometimes contains almost flat triangles at its border, leading to artifacts in plots (especially for high-resolution contouring). Masked with computed new_mask, the encapsulated triangulation would contain no more unmasked border triangles with a circle ratio below min_circle_ratio, thus improving the mesh quality for subsequent plots or interpolation. 
   propertyscale_factors
 
Factors to rescale the triangulation into a unit square.  Returns 
 (float, float)

Scaling factors (kx, ky) so that the triangulation [triangulation.x * kx, triangulation.y * ky] fits exactly inside a unit square.