
    h                     N    S SK rS SKJr  S SKJr   " S S5      r " S S\5      rg)    N)_api)Triangulationc                   $    \ rS rSrSrS rS rSrg)	TriFinder   af  
Abstract base class for classes used to find the triangles of a
Triangulation in which (x, y) points lie.

Rather than instantiate an object of a class derived from TriFinder, it is
usually better to use the function `.Triangulation.get_trifinder`.

Derived classes implement __call__(x, y) where x and y are array-like point
coordinates of the same shape.
c                 B    [         R                  " [        US9  Xl        g )N)triangulation)r   check_isinstancer   _triangulation)selfr	   s     K/var/www/html/env/lib/python3.13/site-packages/matplotlib/tri/_trifinder.py__init__TriFinder.__init__   s    m=I+    c                     [         e)N)NotImplementedError)r   xys      r   __call__TriFinder.__call__   s    !!r   )r   N)__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes__ r   r   r   r      s    	,"r   r   c                   D   ^  \ rS rSrSrU 4S jrS rS rS rS r	Sr
U =r$ )	TrapezoidMapTriFinder   a  
`~matplotlib.tri.TriFinder` class implemented using the trapezoid
map algorithm from the book "Computational Geometry, Algorithms and
Applications", second edition, by M. de Berg, M. van Kreveld, M. Overmars
and O. Schwarzkopf.

The triangulation must be valid, i.e. it must not have duplicate points,
triangles formed from colinear points, or overlapping triangles.  The
algorithm has some tolerance to triangles formed from colinear points, but
this should not be relied upon.
c                    > SSK Jn  [        TU ]  U5        UR	                  UR                  5       5      U l        U R                  5         g )Nr   )_tri)
matplotlibr"   superr   r   get_cpp_triangulation_cpp_trifinder_initialize)r   r	   r"   	__class__s      r   r   TrapezoidMapTriFinder.__init__(   s>    #'"88//13r   c                 ~   [         R                  " U[         R                  S9n[         R                  " U[         R                  S9nUR                  UR                  :w  a  [	        S5      eU R
                  R                  UR                  5       UR                  5       5      R                  UR                  5      nU$ )a2  
Return an array containing the indices of the triangles in which the
specified *x*, *y* points lie, or -1 for points that do not lie within
a triangle.

*x*, *y* are array-like x and y coordinates of the same shape and any
number of dimensions.

Returns integer array with the same shape and *x* and *y*.
)dtypez.x and y must be array-like with the same shape)	npasarrayfloat64shape
ValueErrorr&   	find_manyravelreshape)r   r   r   indicess       r   r   TrapezoidMapTriFinder.__call__/   s     JJq

+JJq

+77aggMNN &&00AGGIFGAGG$ 	r   c                 6    U R                   R                  5       $ )a.  
Return a python list containing the statistics about the node tree:
    0: number of nodes (tree size)
    1: number of unique nodes
    2: number of trapezoids (tree leaf nodes)
    3: number of unique trapezoids
    4: maximum parent count (max number of times a node is repeated in
           tree)
    5: maximum depth of tree (one more than the maximum number of
           comparisons needed to search through the tree)
    6: mean of all trapezoid depths (one more than the average number
           of comparisons needed to search through the tree)
)r&   get_tree_statsr   s    r   _get_tree_stats%TrapezoidMapTriFinder._get_tree_statsD   s     ""1133r   c                 8    U R                   R                  5         g)zu
Initialize the underlying C++ object.  Can be called multiple times if,
for example, the triangulation is modified.
N)r&   
initializer8   s    r   r'   !TrapezoidMapTriFinder._initializeT       
 	&&(r   c                 8    U R                   R                  5         g)zW
Print a text representation of the node tree, which is useful for
debugging purposes.
N)r&   
print_treer8   s    r   _print_tree!TrapezoidMapTriFinder._print_tree[   r>   r   )r&   )r   r   r   r   r   r   r   r9   r'   rA   r   __classcell__)r(   s   @r   r   r      s&    
*4 )) )r   r   )numpyr,   r#   r   matplotlib.trir   r   r   r   r   r   <module>rF      s&      (" "(E)I E)r   