ó ]Û3Lc@sDddljZddljZddlZdefd„ƒYZdS(iÿÿÿÿNt TriangulationcBseeZdZddd„Zed„ƒZd„Zd„Ze d„ƒZ ed„ƒZ d„Z RS( s× An unstructured triangular grid consisting of npoints points and ntri triangles. The triangles can either be specified by the user or automatically generated using a Delaunay triangulation. Read-only attributes: *x*: array of shape (npoints). x-coordinates of grid points. *y*: array of shape (npoints). y-coordinates of grid points. *triangles*: integer array of shape (ntri,3). For each triangle, the indices of the three points that make up the triangle, ordered in an anticlockwise manner. *mask*: optional boolean array of shape (ntri). Which triangles are masked out. *edges*: integer array of shape (?,2). All edges of non-masked triangles. Each edge is the start point index and end point index. Each edge (start,end and end,start) appears only once. *neighbors*: integer array of shape (ntri,3). For each triangle, the indices of the three triangles that share the same edges, or -1 if there is no such neighboring triangle. neighbors[i,j] is the triangle that is the neighbor to the edge from point index triangles[i,j] to point index triangles[i,(j+1)%3]. cCsYtj|dtjƒ|_tj|dtjƒ|_|jj|jjksft|jjƒdkrutdƒ‚nd |_ d |_ d |_ |d kr8t j |j|jƒ}tj|jdtjƒ|_|d krÛtj|jdtjƒ|_ tj|jdtjƒ}tj|dddƒ|_ qÛn£tj|dtjƒ|_|jjdks{|jjddkrŠtdƒ‚n|jjƒt|jƒkr·tdƒ‚n|jjƒd krÛtd ƒ‚n|d k rLtj|dtjƒ|_ t|j jƒdks:|j jd |jjd krLtd ƒ‚qLnd |_d S( s« Create a Triangulation object. The first two arguments must be: *x*, *y*: arrays of shape (npoints). Point coordinates. Optional arguments (args or keyword args): *triangles*: integer array of shape (ntri,3). For each triangle, the indices of the three points that make up the triangle. If the points are ordered in a clockwise manner, they are converted to anticlockwise. If not specified, matplotlib.delaunay is used to create a Delaunay triangulation of the points. *mask*: optional boolean array of shape (ntri). Which triangles are masked out. tdtypeis'x and y must be equal-length 1-D arraystaxisiistriangles must be a (?,3) arrays&triangles max element is out of boundsis&triangles min element is out of boundss3mask array must have same length as triangles arrayN(tnptasarraytfloat64txtytshapetlent ValueErrortNonetmaskt_edgest _neighborstdelaunayRttriangle_nodestint32t trianglestedge_dbttriangle_neighborstrolltndimtmaxtmintboolt_cpp_triangulation(tselfRRRR tdtt neighbors((sO/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/tri/triangulation.pyt__init__&s60     !(  cCs.|jdkr'|jƒjƒ|_n|jS(N(R R tget_cpp_triangulationt get_edges(R((sO/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/tri/triangulation.pytedgescscCsL|jdkrEtj|j|j|j|j|j|j ƒ|_n|jS(sc Return the underlying C++ Triangulation object, creating it if necessary. N( RR t_triRRRRR R R(R((sO/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/tri/triangulation.pyRis cCs7|jdk r,|jjd|jddƒS|jSdS(sC Return an array of triangles that are not masked. iRiN(R R Rtcompress(R((sO/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/tri/triangulation.pytget_masked_trianglestsc Oslt|dtƒr*|d}|d}n5|d}|d}|d}t}|jddƒ}t}|dkr—t|ƒdkr—|d}t}n|dk rÜytj|dtj ƒ}WqÜt k rØd}qÜXn|dk r|j dks |j ddkrd}n|dk r8|r8|d}t}n|jddƒ}t}|dkrˆ| rˆt|ƒdkrˆ|d}t}n|dk rÍytj|dtj ƒ}WqÍt k rÉd}qÍXn|dk rñ|j dkrñd}n|dk r+|dk r+t|ƒ|j dkr+d}n|dk rJ|rJ|d}nt||||ƒ}|||fS( sÎ Return a Triangulation object from the args and kwargs, and the remaining args and kwargs with the consumed values removed. There are two alternatives: either the first argument is a Triangulation object, in which case it is returned, or the args and kwargs are sufficient to create a new Triangulation to return. In the latter case, see Triangulation.__init__ for the possible args and kwargs. iiiRRiR N(t isinstanceRtTruetpopR tFalseR RRRR RRR( targstkwargst triangulationRRtignore_remaining_argsRt from_argsR ((sO/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/tri/triangulation.pytget_from_args_and_kwargs}sT              %        cCs.|jdkr'|jƒjƒ|_n|jS(N(RR t_get_cpp_triangulationt get_neighbors(R((sO/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/tri/triangulation.pyRÁscCsµ|dkrd|_nbtj|dtjƒ|_t|jjƒdksk|jjd|jjdkrztdƒ‚n|j dk rŸ|j j |jƒnd|_ d|_ dS(sp Set or clear the mask array. This is either None, or a boolean array of shape (ntri). Riis3mask array must have same length as triangles arrayN( R R RRRR RRR Rtset_maskR R(RR ((sO/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/tri/triangulation.pyR1Çs    N( t__name__t __module__t__doc__R RtpropertyR!RR$t staticmethodR.RR1(((sO/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/tri/triangulation.pyRs = D(tmatplotlib.delaunayRtmatplotlib._triR"tnumpyRtobjectR(((sO/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/tri/triangulation.pyts