
    2ri                     :    d dl Zg dZd Zd ZddZddZddZdS )	    N)delaunay_plot_2dconvex_hull_plot_2dvoronoi_plot_2dc                  Z    dd l m}  |                                                                 S )Nr   )matplotlib.pyplotpyplotfiguregca)plts    x/var/www/html/bestrading.cuttalo.com/services/ml-inference/venv/lib/python3.11/site-packages/scipy/spatial/_plotutils.py	_get_axesr      s.    ######::<<    c                 $   dt          j        |d          z  }|                    d          |z
  }|                    d          |z   }|                     |d         |d                    |                     |d         |d                    d S )Ng?r   axis   )npptpminmaxset_xlimset_ylim)axpointsmarginxy_minxy_maxs        r   _adjust_boundsr      s    26&q))))FZZQZ&(FZZQZ&(FKKq	6!9%%%KKq	6!9%%%%%r   c                 L   | j         j        d         dk    rt          d          | j         j        \  }}|pt	                      }|                    ||d           |                    ||| j                                                   t          || j                    |j
        S )aB  
    Plot the given Delaunay triangulation in 2-D

    Parameters
    ----------
    tri : scipy.spatial.Delaunay instance
        Triangulation to plot
    ax : matplotlib.axes.Axes instance, optional
        Axes to plot on

    Returns
    -------
    fig : matplotlib.figure.Figure instance
        Figure for the plot

    See Also
    --------
    Delaunay
    matplotlib.pyplot.triplot

    Notes
    -----
    Requires Matplotlib.

    Examples
    --------

    >>> import numpy as np
    >>> import matplotlib.pyplot as plt
    >>> from scipy.spatial import Delaunay, delaunay_plot_2d

    The Delaunay triangulation of a set of random points:

    >>> rng = np.random.default_rng()
    >>> points = rng.random((30, 2))
    >>> tri = Delaunay(points)

    Plot it:

    >>> _ = delaunay_plot_2d(tri)
    >>> plt.show()

    r      z!Delaunay triangulation is not 2-Do)r   shape
ValueErrorTr   plottriplot	simplicescopyr   r	   )trir   xys       r   r   r      s    X za<===:<DAq		y{{BGGAq#JJq!S]''))***2sz"""9r   c                     ddl m}  j        j        d         dk    rt	          d          |pt                      }|                     j        dddf          j        dddf         d            fd j        D             }|                     ||d	d
                     t          | j                   |j
        S )a&  
    Plot the given convex hull diagram in 2-D

    Parameters
    ----------
    hull : scipy.spatial.ConvexHull instance
        Convex hull to plot
    ax : matplotlib.axes.Axes instance, optional
        Axes to plot on

    Returns
    -------
    fig : matplotlib.figure.Figure instance
        Figure for the plot

    See Also
    --------
    ConvexHull

    Notes
    -----
    Requires Matplotlib.


    Examples
    --------

    >>> import numpy as np
    >>> import matplotlib.pyplot as plt
    >>> from scipy.spatial import ConvexHull, convex_hull_plot_2d

    The convex hull of a random set of points:

    >>> rng = np.random.default_rng()
    >>> points = rng.random((30, 2))
    >>> hull = ConvexHull(points)

    Plot it:

    >>> _ = convex_hull_plot_2d(hull)
    >>> plt.show()

    r   LineCollectionr   r    zConvex hull is not 2-DNr!   c                 *    g | ]}j         |         S  )r   ).0simplexhulls     r   
<listcomp>z'convex_hull_plot_2d.<locals>.<listcomp>   s     HHHgT[)HHHr   ksolid)colors	linestyle)matplotlib.collectionsr.   r   r"   r#   r   r%   r'   add_collectionr   r	   )r3   r   r.   line_segmentss   `   r   r   r   N   s    X 655555{q  1222		y{{BGGDK1t{111a40#666HHHHHHHMnn],//68 8 8 9 9 9 2t{###9r   c           	         ddl m} | j        j        d         dk    rt	          d          |pt                      }|                    dd          rM|                    dd	          }|                    | j        d	d	df         | j        d	d	df         d
|           |                    dd          r5|                    | j        d	d	df         | j        d	d	df         d           |                    dd          }|                    dd          }|                    dd          }| j        	                    d          }t          j        | j        d          }	g }
g }t          | j        | j                  D ]\  }}t          j        |          }t          j        |dk              r!|
                    | j        |                    S||dk             d         }| j        |d                  | j        |d                  z
  }|t          j                            |          z  }t          j        |d          |d         g          }| j        |         	                    d          }t          j        t          j        ||z
  |                    |z  }| j        r| }t1          |	                                |	                                z            }| j        |         ||	                                z  |z  z   }|                    | j        |         |g           |                     ||
|||d                     |                     |||||d                     t9          || j                   |j        S )ae  
    Plot the given Voronoi diagram in 2-D

    Parameters
    ----------
    vor : scipy.spatial.Voronoi instance
        Diagram to plot
    ax : matplotlib.axes.Axes instance, optional
        Axes to plot on
    show_points : bool, optional
        Add the Voronoi points to the plot.
    show_vertices : bool, optional
        Add the Voronoi vertices to the plot.
    line_colors : string, optional
        Specifies the line color for polygon boundaries
    line_width : float, optional
        Specifies the line width for polygon boundaries
    line_alpha : float, optional
        Specifies the line alpha for polygon boundaries
    point_size : float, optional
        Specifies the size of points

    Returns
    -------
    fig : matplotlib.figure.Figure instance
        Figure for the plot

    See Also
    --------
    Voronoi

    Notes
    -----
    Requires Matplotlib. For degenerate input, including collinearity and
    other violations of general position, it may be preferable to
    calculate the Voronoi diagram with Qhull options ``QJ`` for random
    joggling, or ``Qt`` to enforce triangulated output. Otherwise, some
    Voronoi regions may not be visible.

    Examples
    --------
    >>> import numpy as np
    >>> import matplotlib.pyplot as plt
    >>> from scipy.spatial import Voronoi, voronoi_plot_2d

    Create a set of points for the example:

    >>> rng = np.random.default_rng()
    >>> points = rng.random((10,2))

    Generate the Voronoi diagram for the points:

    >>> vor = Voronoi(points)

    Use `voronoi_plot_2d` to plot the diagram:

    >>> fig = voronoi_plot_2d(vor)

    Use `voronoi_plot_2d` to plot the diagram again, with some settings
    customized:

    >>> fig = voronoi_plot_2d(vor, show_vertices=False, line_colors='orange',
    ...                       line_width=2, line_alpha=0.6, point_size=2)
    >>> plt.show()

    r   r-   r   r    zVoronoi diagram is not 2-Dshow_pointsT
point_sizeN.)
markersizeshow_verticesr!   line_colorsr5   
line_widthg      ?
line_alphar   r6   )r7   lwalphar8   dashed)r9   r.   r   r"   r#   r   getr%   verticesmeanr   r   zipridge_pointsridge_verticesasarrayallappendlinalgnormarraysigndotfurthest_siteabsr   r   r:   r   r	   )vorr   kwr.   r>   rB   rC   rD   center	ptp_boundfinite_segmentsinfinite_segmentspointidxr2   itnmidpoint	directionaspect_factor	far_points                        r   r   r      s   F 655555
za5666		y{{B	vvmT"" PVVL$//


111a4 #*QQQT"2CJOOO	vvot$$ =
QQQT"CLA$6<<<&&,,Kc**Jc**JZ__!_$$Fsz***IO !133EFF C C'*W%%6'Q, 	C""3<#899991%a(A
8A;'#*Xa[*AAA"""A1Q4%1''Az(+00a088Hx&'8! < <==AI! '&J		)--// ABBMQ)immoo*E*UUI$$cl1oy%ABBBBnn_,7(2+5/6	8 8 8 9 9 9
 nn%6,7(2+5/7	9 9 9 : : : 2sz"""9r   )N)numpyr   __all__r   r   r   r   r   r0   r   r   <module>rh      s       
H
H
H  & & &7 7 7 7t9 9 9 9xz z z z z zr   