HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pyc
�
_�3Lc@s�ddlZyeWn&ek
r<ddlZejZnXddlZddlmZddl	m
Z
mZddgZde
fd��YZdefd��YZdS(i����N(tdelaunay(tLinearInterpolatortNNInterpolatort
TriangulationtDuplicatePointWarningcBseZdZRS(sBDuplicate points were passed in to the triangulation routine.
    (t__name__t
__module__t__doc__(((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pyRscBs�eZdZd�Zd�Zd�Zejd�Zejd�Z	d
d�Zd
ejd�Zd
ejd�Z
d	�ZRS(swA Delaunay triangulation of points in a plane.

    Triangulation(x, y)
    x, y -- the coordinates of the points as 1-D arrays of floats

    Let us make the following definitions:
        npoints = number of points input
        nedges = number of edges in the triangulation
        ntriangles = number of triangles in the triangulation

        point_id = an integer identifying a particular point (specifically, an
            index into x and y), range(0, npoints)
        edge_id = an integer identifying a particular edge, range(0, nedges)
        triangle_id = an integer identifying a particular triangle
            range(0, ntriangles)

    Attributes: (all should be treated as read-only to maintain consistency)
      x, y -- the coordinates of the points as 1-D arrays of floats.

      circumcenters -- (ntriangles, 2) array of floats giving the (x,y)
        coordinates of the circumcenters of each triangle (indexed by a
        triangle_id).

      edge_db -- (nedges, 2) array of point_id's giving the points forming
        each edge in no particular order; indexed by an edge_id.

      triangle_nodes -- (ntriangles, 3) array of point_id's giving the points
        forming each triangle in counter-clockwise order; indexed by a
        triangle_id.

      triangle_neighbors -- (ntriangles, 3) array of triangle_id's giving the
        neighboring triangle; indexed by a triangle_id.

        The value can also be -1 meaning that that edge is on the convex hull of
        the points and there is no neighbor on that edge. The values are ordered
        such that triangle_neighbors[tri, i] corresponds with the edge
        *opposite* triangle_nodes[tri, i]. As such, these neighbors are also in
        counter-clockwise order.

      hull -- list of point_id's giving the nodes which form the convex hull
        of the point set. This list is sorted in counter-clockwise order.
    cCs0tj|dtj�|_tj|dtj�|_|jj|jjksft|jj�dkrutd��n|jj|_|j	�}|j|jjkr�t
jdt�||_
|j|j
|_|j|j
|_n	d|_
t|j|j�\|_|_|_|_|j�|_dS(Ntdtypeis#x,y must be equal-length 1-D arrayssBInput data contains duplicate x,y points; some values are ignored.(tnptasarraytfloat64txtytshapetlent
ValueErrort	old_shapet_collapse_duplicate_pointstwarningstwarnRtj_uniquetNoneRt
circumcenterstedge_dbttriangle_nodesttriangle_neighborst_compute_convex_hullthull(tselfRR
R((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pyt__init__As 0		-cCsktjd|j|jf�}tjttj|j|�dktj|j|�dkBg�}||S(s�Generate index array that picks out unique x,y points.

        This appears to be required by the underlying delaunay triangulation
        code.
        tkeysi(R	tlexsortRR
thstacktTruetdiff(Rtj_sortedtmask_unique((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pyR\s
<cCs�|jdk}i}|jtt|j|dd�dfdd�df|j|dd�dfdd�df���|jtt|j|dd�dfdd�df|j|dd�dfdd�df���|jtt|j|dd�dfdd�df|j|dd�dfdd�df���t|j��}x$|r�|j|j|d��qhW|j�|S(s�Extract the convex hull from the triangulation information.

        The output will be a list of point_id's in counter-clockwise order
        forming the convex hull of the data set.
        i����Niii(	RtupdatetdicttzipRtlisttpopitemtappendtpop(RtbordertedgesR((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pyRjs646464	
cCshtj|dtj�}|j|jkr9td��n|jdk	rX||j}nt|||�S(s�Get an object which can interpolate within the convex hull by
        assigning a plane to each triangle.

        z -- an array of floats giving the known function values at each point
          in the triangulation.
        Rs#z must be the same shape as x and yN(	R	R
RRRRRRR(Rtzt
default_value((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pytlinear_interpolator�scCshtj|dtj�}|j|jkr9td��n|jdk	rX||j}nt|||�S(s�Get an object which can interpolate within the convex hull by
        the natural neighbors method.

        z -- an array of floats giving the known function values at each point
          in the triangulation.
        Rs#z must be the same shape as x and yN(	R	R
RRRRRRR(RR/R0((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pytnn_interpolator�scCs\|dkr=|jd|jd|jd|jdf}ntj|tj�\}}}}t|tjj|j��}t|tjj|j��}t	|tj
j|j��}t	|tj
j|j��}t	||d||d�}||d}||d}	tj|d|||d|g|	|	d||	d|gg�\}
}tj|j|
f�}tj|j|f�}
|j
||
�}tjt|j�dftj�}|j|dd�df<|j|dd�df<ddlm}|||�\}}}}tj||
|d||d|df�}||fS(Niig@iii����(tlstsq(RRR
R	R
RtmintminimumtreducetmaxtmaximumtarrayR!t	__class__tonesRt
numpy.dualR3(RR/tbboxtminxtmaxxtminytmaxytMtmidxtmidytxptyptx1ty1tnewtritxy1R3tctrestranktstzp((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pytprep_extrapolator�s,1!"+$1cCs(|j||�\}}|j||�S(N(RPR2(RR/R=R0RIRO((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pytnn_extrapolator�scCs(|j||�\}}|j||�S(N(RPR1(RR/R=R0RIRO((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pytlinear_extrapolator�scCshi}x[|jD]P\}}|j|t��}|j|�|j|t��}|j|�qW|S(s�Return a graph of node_id's pointing to node_id's.

        The arcs of the graph correspond to the edges in the triangulation.

        {node_id: set([node_id, ...]), ...}
        (Rt
setdefaulttsettadd(RtgtitjRN((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pyt
node_graph�s
N(RRRRRRR	tnanR1R2RRPRQRRRY(((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pyRs*			(RRTt	NameErrortsetstSettnumpyR	tmatplotlib._delaunayRtinterpolateRRt__all__tRuntimeWarningRtobjectR(((sR/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/delaunay/triangulate.pyt<module>s