§
    p¬¸jtÅ  ã                   ó@  — d Z ddlZddlZddlmZ ddlmZmZm	Z	m
ZmZmZmZ ddlmZmZmZmZmZ ddlmZ ddlmZ dd	lmZ d
„ Zd„ Zd„ Zd„ Z  G d„ dej!        ¦  «        Z"d7d„Z# G d„ dej$        ¦  «        Z%d7d„Z&d8d„Z'd8d„Z(d8d„Z)d8d„Z* G d„ de¦  «        Z+d7d„Z, G d„ de¦  «        Z-d7d„Z. G d „ d!e¦  «        Z/ G d"„ d#e/¦  «        Z0d$„ Z1d7d%„Z2d8d&„Z3 G d'„ d(e¦  «        Z4 G d)„ d*e¦  «        Z5d9d,„Z6 G d-„ d.e¦  «        Z7d7d/„Z8d0„ Z9d1„ Z:d2„ Z;d:d4„Z<d5„ Z=d;d6„Z>dS )<zx
Module containing 3D artist code and functions to convert 2D
artists into 3D versions which can be added to an Axes3D.
é    N)Úcontextmanager)Ú_apiÚartistÚcbookÚcolorsÚlinesÚtextÚpath)Ú
CollectionÚLineCollectionÚPolyCollectionÚPatchCollectionÚPathCollection)Ú	Normalize)ÚPatché   )Úproj3dc                 ó,   — | dz   dz  } | dk    r| dz
  } | S )z?Return the given angle normalized to -180 < *a* <= 180 degrees.ih  é´   © ©Úas    új/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/mpl_toolkits/mplot3d/art3d.pyÚ_norm_angler      s&   € à	
ˆS‰�C‰€AØˆ3‚w€wØ�‰GˆØ€Hó    c                 ó,   — | dz   dz  } | dk    r| dz
  } | S )z=Return the given angle normalized to -90 < *a* <= 90 degrees.r   éZ   r   r   s    r   Ú_norm_text_angler   "   s&   € à	
ˆS‰�C‰€AØˆ2‚v€vØ�‰GˆØ€Hr   c                 ó^  — | dk    rt          j        d¦  «        S | dk    rt          j        d¦  «        S | dk    rt          j        d¦  «        S | €t          j        d¦  «        S t          j        | ¦  «        r't          | ¦  «        d	k    rt          j        | ¦  «        S t	          d
¦  «        ‚)a½  
    Return a direction vector.

    Parameters
    ----------
    zdir : {'x', 'y', 'z', None, 3-tuple}
        The direction. Possible values are:

        - 'x': equivalent to (1, 0, 0)
        - 'y': equivalent to (0, 1, 0)
        - 'z': equivalent to (0, 0, 1)
        - *None*: equivalent to (0, 0, 0)
        - an iterable (x, y, z) is converted to an array

    Returns
    -------
    x, y, z : array
        The direction vector.
    Úx)r   r   r   Úy)r   r   r   Úz)r   r   r   N)r   r   r   é   z2'x', 'y', 'z', None or vector of length 3 expected)ÚnpÚarrayÚiterableÚlenÚ
ValueError)Úzdirs    r   Úget_dir_vectorr*   *   s¢   € ð( ˆs‚{€{ÝŒx˜	Ñ"Ô"Ð"Ø	�ŠˆÝŒx˜	Ñ"Ô"Ð"Ø	�ŠˆÝŒx˜	Ñ"Ô"Ð"Ø	ˆÝŒx˜	Ñ"Ô"Ð"Ý	Œ�TÑ	Ô	ð O�s 4™yœy¨Aš~˜~ÝŒx˜‰~Œ~ÐåÐMÑNÔNÐNr   c           	      óÄ  — t           j                             | |j        j        k     | |j        j        k    ||j        j        k     ||j        j        k    ||j        j        k     ||j        j        k    f¦  «        }t           j	         
                    | |¬¦  «        }t           j	         
                    ||¬¦  «        }t           j	         
                    ||¬¦  «        }|||fS )aM  
    Return original points with points outside the axes view limits masked.

    Parameters
    ----------
    xs, ys, zs : array-like
        The points to mask.
    axes : Axes3D
        The axes to use for the view limits.

    Returns
    -------
    xs_masked, ys_masked, zs_masked : np.ma.array
        The masked points.
    )Úmask)r$   Ú
logical_orÚreduceÚ
xy_viewLimÚxminÚxmaxÚyminÚymaxÚ
zz_viewLimÚmar%   )ÚxsÚysÚzsÚaxesr,   Ú	xs_maskedÚ	ys_maskedÚ	zs_maskeds           r   Ú_viewlim_maskr=   L   sÁ   € õ  Œ=×Ò  d¤oÔ&:Ò!:Ø!# d¤oÔ&:Ò!:Ø!# d¤oÔ&:Ò!:Ø!# d¤oÔ&:Ò!:Ø!# d¤oÔ&:Ò!:Ø!# d¤oÔ&:Ò!:ð!<ñ =ô =€Dõ ”—’˜B T�Ñ*Ô*€IÝ”—’˜B T�Ñ*Ô*€IÝ”—’˜B T�Ñ*Ô*€IØ�i Ð*Ð*r   c                   óh   ‡ — e Zd ZdZdd„Zd„ Zdˆ fd	„	Zd
„ Zdd„Ze	j
        d„ ¦   «         Zdd„Zˆ xZS )ÚText3Da*  
    Text object with 3D position and direction.

    Parameters
    ----------
    x, y, z : float
        The position of the text.
    text : str
        The text string to display.
    zdir : {'x', 'y', 'z', None, 3-tuple}
        The direction of the text. See `.get_dir_vector` for a description of
        the values.
    axlim_clip : bool, default: False
        Whether to hide text outside the axes view limits.

    Other Parameters
    ----------------
    **kwargs
         All other parameters are passed on to `~matplotlib.text.Text`.
    r   Ú r"   Fc                 óh   — t          j        j        | |||fi |¤Ž |                      |||¦  «         d S ©N)ÚmtextÚTextÚ__init__Úset_3d_properties)Úselfr    r!   r"   r	   r)   Ú
axlim_clipÚkwargss           r   rE   zText3D.__init__~   sA   € åŒ
Ô˜D ! Q¨Ð7Ð7°Ð7Ð7Ð7Ø×Ò˜q $¨
Ñ3Ô3Ð3Ð3Ð3r   c                 ó*   — | j         | j        | j        fS )z*Return the (x, y, z) position of the text.)Ú_xÚ_yÚ_z©rG   s    r   Úget_position_3dzText3D.get_position_3dƒ   s   € àŒw˜œ ¤Ð(Ð(r   Nc                 óÀ   •— t          ¦   «                              |dd…         ¦  «         |                      |d         ¦  «         |�t          |¦  «        | _        dS dS )ax  
        Set the (*x*, *y*, *z*) position of the text.

        Parameters
        ----------
        xyz : (float, float, float)
            The position in 3D space.
        zdir : {'x', 'y', 'z', None, 3-tuple}
            The direction of the text. If unspecified, the *zdir* will not be
            changed. See `.get_dir_vector` for a description of the values.
        Né   )ÚsuperÚset_positionÚset_zr*   Ú_dir_vec)rG   Úxyzr)   Ú	__class__s      €r   Úset_position_3dzText3D.set_position_3d‡   s\   ø€ õ 	‰Œ×Ò˜S  ! œWÑ%Ô%Ð%Ø�
Š
�3�q”6ÑÔÐØÐÝ*¨4Ñ0Ô0ˆDŒMˆMˆMð Ðr   c                 ó"   — || _         d| _        dS )zl
        Set the *z* position of the text.

        Parameters
        ----------
        z : float
        TN)rM   Ústale)rG   r"   s     r   rT   zText3D.set_z˜   s   € ð ˆŒØˆŒ
ˆ
ˆ
r   c                 óX   — || _         t          |¦  «        | _        || _        d| _        dS )a«  
        Set the *z* position and direction of the text.

        Parameters
        ----------
        z : float
            The z-position in 3D space.
        zdir : {'x', 'y', 'z', 3-tuple}
            The direction of the text. Default: 'z'.
            See `.get_dir_vector` for a description of the values.
        axlim_clip : bool, default: False
            Whether to hide text outside the axes view limits.
        TN)rM   r*   rU   Ú_axlim_cliprZ   )rG   r"   r)   rH   s       r   rF   zText3D.set_3d_properties£   s-   € ð ˆŒÝ& tÑ,Ô,ˆŒØ%ˆÔØˆŒ
ˆ
ˆ
r   c                 óp  — | j         r|t          | j        | j        | j        | j        ¦  «        \  }}}t          j                             |||f¦  «         	                    ¦   «          
                    t          j        ¦  «        }n,| j        | j        | j        }}}t          j        |||g¦  «        }t          j        ||| j        z   g| j        j        ¦  «        }|d         d         |d         d         z
  }|d         d         |d         d         z
  }t#          j        t#          j        ||¦  «        ¦  «        }	t)          j        | |d         d         |d         d         t-          |	¦  «        ¬¦  «        5  t.          j                             | |¦  «         d d d ¦  «         n# 1 swxY w Y   d| _        d S )Nr   r   )rK   rL   Ú	_rotationF)r\   r=   rK   rL   rM   r9   r$   r5   Ú	row_stackÚravelÚfilledÚnanÚ
asanyarrayr   Ú_proj_trans_pointsrU   ÚMÚmathÚdegreesÚatan2r   Ú_setattr_cmr   rC   rD   ÚdrawrZ   )
rG   Úrendererr6   r7   r8   Ú
position3dÚprojÚdxÚdyÚangles
             r   rj   zText3D.draw¶   s¹  € àÔð 	5Ý& t¤w°´¸¼À$Ä)ÑLÔL‰JˆB��BÝœŸš¨"¨b°"¨Ñ6Ô6×<Ò<Ñ>Ô>×EÒEÅbÄfÑMÔMˆJˆJàœ $¤'¨4¬7�B�ˆBÝœ¨¨B° |Ñ4Ô4ˆJåÔ(Ø˜ d¤mÑ3Ð4°d´i´kñCô Cˆà�!ŒW�QŒZ˜$˜qœ' !œ*Ñ$ˆØ�!ŒW�QŒZ˜$˜qœ' !œ*Ñ$ˆÝ”�TœZ¨¨BÑ/Ô/Ñ0Ô0ˆÝÔ˜t¨¨Q¬°¬
°t¸A´w¸q´zÝ)9¸%Ñ)@Ô)@ðBñ Bô Bð 	,ð 	,åŒJ�OŠO˜D (Ñ+Ô+Ð+ð	,ð 	,ð 	,ñ 	,ô 	,ð 	,ð 	,ð 	,ð 	,ð 	,ð 	,øøøð 	,ð 	,ð 	,ð 	,ð ˆŒ
ˆ
ˆ
s   Å7!F$Æ$F(Æ+F(c                 ó   — d S rB   r   )rG   rk   s     r   Úget_tightbboxzText3D.get_tightbboxÉ   s	   € ð ˆtr   )r   r   r   r@   r"   FrB   ©r   r"   F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rE   rO   rX   rT   rF   r   Úallow_rasterizationrj   rr   Ú__classcell__©rW   s   @r   r?   r?   h   sÀ   ø€ € € € € ðð ð*4ð 4ð 4ð 4ð
)ð )ð )ð1ð 1ð 1ð 1ð 1ð 1ð"	ð 	ð 	ðð ð ð ð& Ôðð ñ  Ôðð$ð ð ð ð ð ð ð r   r?   r"   Fc                 óL   — t           | _        |                      |||¦  «         dS )ax  
    Convert a `.Text` to a `.Text3D` object.

    Parameters
    ----------
    z : float
        The z-position in 3D space.
    zdir : {'x', 'y', 'z', 3-tuple}
        The direction of the text. Default: 'z'.
        See `.get_dir_vector` for a description of the values.
    axlim_clip : bool, default: False
        Whether to hide text outside the axes view limits.
    N)r?   rW   rF   )Úobjr"   r)   rH   s       r   Útext_2d_to_3dr}   Ï   s)   € õ €C„MØ×Ò˜!˜T :Ñ.Ô.Ð.Ð.Ð.r   c                   ó`   ‡ — e Zd ZdZddœˆ fd„
Zdd„Zd„ Zd	„ Zej	        ˆ fd
„¦   «         Z
ˆ xZS )ÚLine3Da²  
    3D line object.

    .. note:: Use `get_data_3d` to obtain the data associated with the line.
            `~.Line2D.get_data`, `~.Line2D.get_xdata`, and `~.Line2D.get_ydata` return
            the x- and y-coordinates of the projected 2D-line, not the x- and y-data of
            the 3D-line. Similarly, use `set_data_3d` to set the data, not
            `~.Line2D.set_data`, `~.Line2D.set_xdata`, and `~.Line2D.set_ydata`.
    F)rH   c                ó€   •—  t          ¦   «         j        g g g|¢R i |¤Ž |                      |||¦  «         || _        dS )aM  

        Parameters
        ----------
        xs : array-like
            The x-data to be plotted.
        ys : array-like
            The y-data to be plotted.
        zs : array-like
            The z-data to be plotted.
        *args, **kwargs
            Additional arguments are passed to `~matplotlib.lines.Line2D`.
        N)rR   rE   Úset_data_3dr\   )rG   r6   r7   r8   rH   ÚargsrI   rW   s          €r   rE   zLine3D.__init__ì   sT   ø€ ð 	�‰ŒÔ˜˜RÐ1 $Ð1Ð1Ð1¨&Ð1Ð1Ð1Ø×Ò˜˜R Ñ$Ô$Ð$Ø%ˆÔÐÐr   r   r"   c                 ó0  — |                       ¦   «         }|                      ¦   «         }t          j        |¦  «                             ¦   «         }t          j        |t          |¦  «        ¦  «        }t          ||||¦  «        | _	        || _
        d| _        dS )a  
        Set the *z* position and direction of the line.

        Parameters
        ----------
        zs : float or array of floats
            The location along the *zdir* axis in 3D space to position the
            line.
        zdir : {'x', 'y', 'z'}
            Plane to plot line orthogonal to. Default: 'z'.
            See `.get_dir_vector` for a description of the values.
        axlim_clip : bool, default: False
            Whether to hide lines with an endpoint outside the axes view limits.
        TN)Ú	get_xdataÚ	get_ydatar   Ú_to_unmasked_float_arrayr`   r$   Úbroadcast_tor'   Újuggle_axesÚ_verts3dr\   rZ   )rG   r8   r)   rH   r6   r7   s         r   rF   zLine3D.set_3d_propertiesþ   s}   € ð �^Š^ÑÔˆØ�^Š^ÑÔˆÝÔ+¨BÑ/Ô/×5Ò5Ñ7Ô7ˆÝŒ_˜R¥ R¡¤Ñ)Ô)ˆÝ# B¨¨B°Ñ5Ô5ˆŒØ%ˆÔØˆŒ
ˆ
ˆ
r   c                 óÐ   — t          |¦  «        dk    r|d         }t          d|¦  «        D ]+\  }}t          j        |¦  «        st	          |› d�¦  «        ‚Œ,|| _        d| _        dS )ag  
        Set the x, y and z data

        Parameters
        ----------
        x : array-like
            The x-data to be plotted.
        y : array-like
            The y-data to be plotted.
        z : array-like
            The z-data to be plotted.

        Notes
        -----
        Accepts x, y, z arguments or a single array-like (x, y, z)
        r   r   rV   z must be a sequenceTN)r'   Úzipr$   r&   ÚRuntimeErrorr‰   rZ   )rG   r‚   ÚnamerV   s       r   r�   zLine3D.set_data_3d  s}   € õ" ˆt‰9Œ9˜Š>ˆ>Ø˜”7ˆDÝ˜U DÑ)Ô)ð 	Að 	A‰IˆD�#Ý”;˜sÑ#Ô#ð AÝ" dÐ#?Ð#?Ð#?Ñ@Ô@Ð@ðAàˆŒØˆŒ
ˆ
ˆ
r   c                 ó   — | j         S )z­
        Get the current data

        Returns
        -------
        verts3d : length-3 tuple or array-like
            The current data as a tuple or array-like.
        )r‰   rN   s    r   Úget_data_3dzLine3D.get_data_3d.  s   € ð Œ}Ðr   c                 óD  •— | j         rt          g | j        ¢| j        ‘R Ž \  }}}n| j        \  }}}t	          j        |||| j        j        | j        j        ¦  «        \  }}}}|                      ||¦  «         t          ¦   «          
                    |¦  «         d| _        d S )NF)r\   r=   r‰   r9   r   Ú_proj_transform_clipre   Ú_focal_lengthÚset_datarR   rj   rZ   )
rG   rk   Úxs3dÚys3dÚzs3dr6   r7   r8   ÚtisrW   s
            €r   rj   zLine3D.draw9  s©   ø€ àÔð 	-Ý,ÐG¨d¬mÐG¸T¼YÐGÐGÐGÑˆD�$˜˜à#œ}ÑˆD�$˜Ý Ô5°d¸DÀ$Ø6:´i´kØ6:´iÔ6MñOô O‰ˆˆB��Cð 	�Š�b˜"ÑÔÐÝ‰Œ�Š�XÑÔÐØˆŒ
ˆ
ˆ
r   rs   )rt   ru   rv   rw   rE   rF   r�   r�   r   rx   rj   ry   rz   s   @r   r   r   á   s¬   ø€ € € € € ðð ð 6;ð &ð &ð &ð &ð &ð &ð &ð$ð ð ð ð.ð ð ð2	ð 	ð 	ð Ôð
ð 
ð 
ð 
ñ  Ôð
ð 
ð 
ð 
ð 
r   r   c                 óL   — t           | _        |                      |||¦  «         dS )a´  
    Convert a `.Line2D` to a `.Line3D` object.

    Parameters
    ----------
    zs : float
        The location along the *zdir* axis in 3D space to position the line.
    zdir : {'x', 'y', 'z'}
        Plane to plot line orthogonal to. Default: 'z'.
        See `.get_dir_vector` for a description of the values.
    axlim_clip : bool, default: False
        Whether to hide lines with an endpoint outside the axes view limits.
    N)r   rW   rF   )Úliner8   r)   rH   s       r   Úline_2d_to_3drš   G  s)   € õ €D„NØ×Ò˜2˜t ZÑ0Ô0Ð0Ð0Ð0r   c                 óÊ   ‡— t          j        |t          | ¦  «        ¦  «        }|                      dd¬¦  «        }d„ t	          ||¦  «        D ¦   «         }ˆfd„|D ¦   «         }|S )zConvert a path to a 3D segment.F©ÚsimplifyÚcurvesc                 ó*   — g | ]\  \  \  }}}}|||f‘ŒS r   r   ©Ú.0r    r!   Úcoder"   s        r   ú
<listcomp>z'_path_to_3d_segment.<locals>.<listcomp>_  s+   € Ð
BÐ
BÐ
BÑ,™.™6˜A˜q 4¨!ˆAˆq�!ˆ9Ð
BÐ
BÐ
Br   c                 ó<   •— g | ]\  }}}t          |||‰¦  «        ‘ŒS r   ©rˆ   ©r¡   r    r!   r"   r)   s       €r   r£   z'_path_to_3d_segment.<locals>.<listcomp>`  s-   ø€ Ð=Ð=Ð=©I¨Q°°1�[˜˜A˜q $Ñ'Ô'Ð=Ð=Ð=r   )r$   r‡   r'   Úiter_segmentsr‹   )r
   r8   r)   ÚpathsegsÚsegÚseg3ds     `   r   Ú_path_to_3d_segmentr«   Z  so   ø€ õ 
Œ˜�S ™YœYÑ	'Ô	'€BØ×!Ò!¨5¸Ð!Ñ?Ô?€HØ
BÐ
Bµ°H¸bÑ0AÔ0AÐ
BÑ
BÔ
B€CØ=Ð=Ð=Ð=¸Ð=Ñ=Ô=€EØ€Lr   c                 ó  ‡— t          j        |¦  «        s#t          j        |t          | ¦  «        ¦  «        }n/t          |¦  «        t          | ¦  «        k    rt	          d¦  «        ‚ˆfd„t          | |¦  «        D ¦   «         }|S )z6Convert paths from a collection object to 3D segments.z-Number of z-coordinates does not match paths.c                 ó8   •— g | ]\  }}t          ||‰¦  «        ‘ŒS r   )r«   ©r¡   r
   Úpathzr)   s      €r   r£   z)_paths_to_3d_segments.<locals>.<listcomp>m  s9   ø€ ð /ð /ð /Ù��eõ    e¨TÑ2Ô2ð /ð /ð /r   )r$   r&   r‡   r'   r(   r‹   )Úpathsr8   r)   Úsegss     ` r   Ú_paths_to_3d_segmentsr²   d  sŠ   ø€ õ Œ;�r‰?Œ?ð NÝŒ_˜R¥ U¡¤Ñ,Ô,ˆˆåˆr‰7Œ7•c˜%‘j”jÒ Ð ÝÐLÑMÔMÐMð/ð /ð /ð /Ý" 5¨"™~œ~ð/ñ /ô /€Dà€Kr   c                 ó  ‡— t          j        |t          | ¦  «        ¦  «        }|                      dd¬¦  «        }d„ t	          ||¦  «        D ¦   «         }|rt	          |Ž \  }}ˆfd„|D ¦   «         }ng }g }|t          |¦  «        fS )z/Convert a path to a 3D segment with path codes.Frœ   c                 ó.   — g | ]\  \  \  }}}}|||f|f‘ŒS r   r   r    s        r   r£   z2_path_to_3d_segment_with_codes.<locals>.<listcomp>w  s0   € ÐNÐNÐNÑ'8¡~©¨¨A°°q�1�a˜�)˜TÐ"ÐNÐNÐNr   c                 ó<   •— g | ]\  }}}t          |||‰¦  «        ‘ŒS r   r¥   r¦   s       €r   r£   z2_path_to_3d_segment_with_codes.<locals>.<listcomp>z  s-   ø€ ÐAÐAÐA±	°°A°q•˜Q  1 dÑ+Ô+ÐAÐAÐAr   )r$   r‡   r'   r§   r‹   Úlist)r
   r8   r)   r¨   Ú	seg_codesr©   Úcodesrª   s     `     r   Ú_path_to_3d_segment_with_codesr¹   r  sœ   ø€ õ 
Œ˜�S ™YœYÑ	'Ô	'€BØ×!Ò!¨5¸Ð!Ñ?Ô?€HØNÐN½CÀÈ"Ñ<MÔ<MÐNÑNÔN€IØð Ý˜)�_‰
ˆˆUØAÐAÐAÐA¸SÐAÑAÔAˆˆàˆØˆØ•$�u‘+”+ÐÐr   c                 óâ   ‡— t          j        |t          | ¦  «        ¦  «        }ˆfd„t          | |¦  «        D ¦   «         }|rt          |Ž \  }}ng g }}t	          |¦  «        t	          |¦  «        fS )zP
    Convert paths from a collection object to 3D segments with path codes.
    c                 ó8   •— g | ]\  }}t          ||‰¦  «        ‘ŒS r   )r¹   r®   s      €r   r£   z4_paths_to_3d_segments_with_codes.<locals>.<listcomp>‡  s9   ø€ ð 9ð 9ð 9Ù%˜$ õ 5°T¸5À$ÑGÔGð 9ð 9ð 9r   )r$   r‡   r'   r‹   r¶   )r°   r8   r)   Úsegments_codesÚsegmentsr¸   s     `   r   Ú _paths_to_3d_segments_with_codesr¾   �  s„   ø€ õ
 
Œ˜�S ™ZœZÑ	(Ô	(€Bð9ð 9ð 9ð 9Ý),¨U°B©¬ð9ñ 9ô 9€Nàð !Ý˜~Ð.‰ˆ�%�%à˜b�%ˆÝ�‰>Œ>�4 ™;œ;Ð&Ð&r   c                   ó   — e Zd ZdZd„ ZdS )ÚCollection3DzA collection of 3D paths.c                 ó:  ‡ — d„ ‰ j         D ¦   «         }‰ j        rˆ fd„|D ¦   «         }ˆ fd„|D ¦   «         }d„ t          |‰ j         ¦  «        D ¦   «         ‰ _        t	          j        d„ |D ¦   «         ¦  «        }t          |¦  «        r|                     ¦   «         ndS )z0Project the points according to renderer matrix.c                 ó   — g | ]\  }}|‘ŒS r   r   )r¡   ÚvsÚ_s      r   r£   z1Collection3D.do_3d_projection.<locals>.<listcomp>•  s   € Ð7Ð7Ð7™%˜"˜a�2Ð7Ð7Ð7r   c                 ó„   •— g | ]<}t           j                             t          g |j        ¢‰j        ‘R Ž ¦  «        j        ‘Œ=S r   )r$   r5   r_   r=   ÚTr9   ©r¡   rÃ   rG   s     €r   r£   z1Collection3D.do_3d_projection.<locals>.<listcomp>—  sQ   ø€ ð *ð *ð *Øõ ”u—’¥}Ð'F°b´dÐ'F¸D¼IÐ'FÐ'FÐ'FÑGÔGÔIð *ð *ð *r   c                 óT   •— g | ]$}t          j        g |j        ¢‰j        j        ‘R Ž ‘Œ%S r   )r   Úproj_transformrÆ   r9   re   rÇ   s     €r   r£   z1Collection3D.do_3d_projection.<locals>.<listcomp>™  s5   ø€ ÐQÐQÐQÀ2•VÔ*Ð>¨B¬DÐ>°$´)´+Ð>Ð>Ð>ÐQÐQÐQr   c                 óŠ   — g | ]@\  \  }}}\  }}t          j        t          j                             ||g¦  «        |¦  «        ‘ŒAS r   )ÚmpathÚPathr$   r5   Úcolumn_stack)r¡   r6   r7   rÄ   Úcss        r   r£   z1Collection3D.do_3d_projection.<locals>.<listcomp>š  s\   € ð Xð Xð XÙ/™;˜B  A©¨¨Bõ ”z¥"¤%×"4Ò"4°b¸"°XÑ">Ô">ÀÑCÔCð Xð Xð Xr   c                 ó   — g | ]\  }}}|‘Œ	S r   r   )r¡   rÄ   r8   s      r   r£   z1Collection3D.do_3d_projection.<locals>.<listcomp>œ  s   € Ð:Ð:Ð:¡H A q¨"˜RÐ:Ð:Ð:r   ç    eÍÍA)Ú_3dverts_codesr\   r‹   Ú_pathsr$   Úconcatenater'   Úmin)rG   Úvs_listÚ	xyzs_listr8   s   `   r   Údo_3d_projectionzCollection3D.do_3d_projection“  sÒ   ø€ à7Ð7 4Ô#6Ð7Ñ7Ô7ˆØÔð 	*ð*ð *ð *ð *Ø!(ð*ñ *ô *ˆGàQÐQÐQÐQÈÐQÑQÔQˆ	ðXð XÝ36°yÀ$ÔBUÑ3VÔ3VðXñ Xô XˆŒåŒ^Ð:Ð:°	Ð:Ñ:Ô:Ñ;Ô;ˆÝ˜r™7œ7Ð+ˆr�vŠv‰xŒxˆx¨Ð+r   N)rt   ru   rv   rw   r×   r   r   r   rÀ   rÀ   �  s)   € € € € € Ø#Ð#ð
,ð 
,ð 
,ð 
,ð 
,r   rÀ   c                 óN  ‡— t          j        |t          |                      ¦   «         ¦  «        ¦  «        }ˆfd„t	          |                      ¦   «         |¦  «        D ¦   «         | _         t          j        t          d¦  «        t          | ¦  «        ¦  «        | _
        || _        dS )z4Convert a `.Collection` to a `.Collection3D` object.c                 óê   •— g | ]o\  }}t          j        t          g t          j        |j        t          j        |t          |j        ¦  «        ¦  «        g¦  «        j        ¢‰‘R Ž ¦  «        |j        f‘ŒpS r   )r$   rÍ   rˆ   Úverticesr‡   r'   rÆ   r¸   )r¡   Úpr"   r)   s      €r   r£   z'collection_2d_to_3d.<locals>.<listcomp>£  s�   ø€ ð .ð .ð .ñ
 ˆAˆqõ	 
Œ�ð ÝŒ_˜aœj­"¬/¸!½SÀÄ¹_¼_Ñ*MÔ*MÐNÑOÔOÔQðàðð ð ñ 
ô 
ð 
Œð	ð.ð .ð .r   z{}3DN)r$   r‡   r'   Ú	get_pathsr‹   rÑ   r   Ú_make_class_factoryrÀ   ÚtyperW   r\   )Úcolr8   r)   rH   s     ` r   Úcollection_2d_to_3drà      s•   ø€ å	Œ˜�S §¢¡¤Ñ1Ô1Ñ	2Ô	2€Bð.ð .ð .ð .õ
 ˜Ÿš™œ¨Ñ,Ô,ð.ñ .ô .€CÔð D•EÔ-­l¸FÑCÔCÅDÈÁIÄIÑNÔN€C„MØ €C„O€O€Or   c                   ó:   ‡ — e Zd ZdZdˆ fd„	Zd„ Zˆ fd„Zd„ Zˆ xZS )ÚLine3DCollectionz#
    A collection of 3D lines.
    Fc                 óJ   •—  t          ¦   «         j        |fi |¤Ž || _        d S rB   )rR   rE   r\   )rG   r   rH   rI   rW   s       €r   rE   zLine3DCollection.__init__±  s0   ø€ Ø�‰ŒÔ˜Ð)Ð) &Ð)Ð)Ð)Ø%ˆÔÐÐr   c                 ó"   — || _         d| _        dS ©z&Set the position to use for z-sorting.TN©Ú
_sort_zposrZ   ©rG   Úvals     r   Úset_sort_zposzLine3DCollection.set_sort_zposµ  ó   € àˆŒØˆŒ
ˆ
ˆ
r   c                 óX   •— || _         t          ¦   «                              g ¦  «         dS )z"
        Set 3D segments.
        N)Ú_segments3drR   Úset_segments)rG   r½   rW   s     €r   rî   zLine3DCollection.set_segmentsº  s+   ø€ ð $ˆÔÝ‰Œ×Ò˜RÑ Ô Ð Ð Ð r   c                 óô  ‡ — ‰ j         }‰ j        r‘t          j                             |¦  «        }t          j                             g t          g |j        ¢‰ j        ‘R Ž ¢¦  «        }d„ |D ¦   «         }t          j	        |t          j
        |dd…         ¦  «        ¦  «        }ˆ fd„|D ¦   «         }d„ |D ¦   «         }t          j        ‰ |¦  «         d}|D ]#\  }}	}
t          |t          |
¦  «        ¦  «        }Œ$|S )zB
        Project the points according to renderer matrix.
        c                 óB   — g | ]}t          j        |¦  «        d          ‘ŒS )r   )r$   Úshape©r¡   Úsegments     r   r£   z5Line3DCollection.do_3d_projection.<locals>.<listcomp>Ê  s'   € ÐLÐLÐL¸�rœx¨Ñ0Ô0°Ô3ÐLÐLÐLr   Néÿÿÿÿc                 óN   •— g | ]!}t          j        |‰j        j        ¦  «        ‘Œ"S r   )r   rd   r9   re   )r¡   ÚpointsrG   s     €r   r£   z5Line3DCollection.do_3d_projection.<locals>.<listcomp>Ì  s:   ø€ ð +ð +ð +Øõ Ô,¨V°T´Y´[ÑAÔAð +ð +ð +r   c                 óX   — g | ]'\  }}}t           j                             ||g¦  «        ‘Œ(S r   )r$   r5   rÍ   )r¡   r6   r7   r8   s       r   r£   z5Line3DCollection.do_3d_projection.<locals>.<listcomp>Î  s2   € ÐNÐNÐN¹
¸¸BÀ•r”u×)Ò)¨2¨r¨(Ñ3Ô3ÐNÐNÐNr   rÐ   )rí   r\   r$   r5   ÚvstackrÍ   r=   rÆ   r9   ÚsplitÚcumsumr   rî   rÔ   )rG   r½   Ú
all_pointsÚmasked_pointsÚsegment_lengthsÚxyslistÚsegments_2dÚminzr6   r7   r8   s   `          r   r×   z!Line3DCollection.do_3d_projectionÁ  s7  ø€ ð Ô#ˆØÔð 	PÝœŸš hÑ/Ô/ˆJÝœE×.Ò.ð 0Kµð 2JÀ
Äð 2JØ?C¼yð2Jð 2Jð 2Jð 0Kñ Lô LˆMàLÐLÀ8ÐLÑLÔLˆOÝ”x ­r¬y¸ÈÈ"ÈÔ9MÑ/NÔ/NÑOÔOˆHð+ð +ð +ð +Ø!)ð+ñ +ô +ˆàNÐNÀgÐNÑNÔNˆÝÔ# D¨+Ñ6Ô6Ð6ð ˆØ!ð 	&ð 	&‰JˆB��BÝ�t�S ™WœWÑ%Ô%ˆDˆDØˆr   ©F)	rt   ru   rv   rw   rE   rê   rî   r×   ry   rz   s   @r   râ   râ   ­  s~   ø€ € € € € ðð ð&ð &ð &ð &ð &ð &ðð ð ð
!ð !ð !ð !ð !ðð ð ð ð ð ð r   râ   c                 óœ   — t          |                      ¦   «         ||¦  «        }t          | _        |                      |¦  «         || _        dS )z<Convert a `.LineCollection` to a `.Line3DCollection` object.N)r²   rÜ   râ   rW   rî   r\   )rß   r8   r)   rH   Ú
segments3ds        r   Úline_collection_2d_to_3dr  Ø  sA   € å& s§}¢}¡¤¸¸DÑAÔA€JÝ$€C„MØ×Ò�ZÑ Ô Ð Ø €C„O€O€Or   c                   ó@   ‡ — e Zd ZdZddddœˆ fd„
Zdd„Zd	„ Zd
„ Zˆ xZS )ÚPatch3Dz
    3D patch object.
    r   r"   F©r8   r)   rH   c                óh   •—  t          ¦   «         j        |i |¤Ž |                      |||¦  «         dS )aÉ  
        Parameters
        ----------
        verts :
        zs : float
            The location along the *zdir* axis in 3D space to position the
            patch.
        zdir : {'x', 'y', 'z'}
            Plane to plot patch orthogonal to. Default: 'z'.
            See `.get_dir_vector` for a description of the values.
        axlim_clip : bool, default: False
            Whether to hide patches with a vertex outside the axes view limits.
        N)rR   rE   rF   )rG   r8   r)   rH   r‚   rI   rW   s         €r   rE   zPatch3D.__init__å  s?   ø€ ð 	�‰ŒÔ˜$Ð) &Ð)Ð)Ð)Ø×Ò˜r 4¨Ñ4Ô4Ð4Ð4Ð4r   r   c                 óœ   ‡— t          j        |t          |¦  «        ¦  «        }ˆfd„t          ||¦  «        D ¦   «         | _        || _        dS )a  
        Set the *z* position and direction of the patch.

        Parameters
        ----------
        verts :
        zs : float
            The location along the *zdir* axis in 3D space to position the
            patch.
        zdir : {'x', 'y', 'z'}
            Plane to plot patch orthogonal to. Default: 'z'.
            See `.get_dir_vector` for a description of the values.
        axlim_clip : bool, default: False
            Whether to hide patches with a vertex outside the axes view limits.
        c                 ó@   •— g | ]\  \  }}}t          |||‰¦  «        ‘ŒS r   r¥   r¦   s       €r   r£   z-Patch3D.set_3d_properties.<locals>.<listcomp>  s?   ø€ ð >ð >ð >Ù*¡  A¨õ ' q¨!¨Q°Ñ5Ô5ð >ð >ð >r   N)r$   r‡   r'   r‹   Ú
_segment3dr\   )rG   Úvertsr8   r)   rH   s      ` r   rF   zPatch3D.set_3d_propertiesö  s\   ø€ õ  Œ_˜R¥ U¡¤Ñ,Ô,ˆð>ð >ð >ð >Ý.1°%¸©n¬nð>ñ >ô >ˆŒà%ˆÔÐÐr   c                 óž   — t          | d¦  «        s7| j                             ¦   «         | j        _        |                      ¦   «          | j        S )NÚ_path2d)Úhasattrr9   Úget_projre   r×   r  rN   s    r   Úget_pathzPatch3D.get_path  sG   € õ �t˜YÑ'Ô'ð 	$Øœ)×,Ò,Ñ.Ô.ˆDŒIŒKØ×!Ò!Ñ#Ô#Ð#ØŒ|Ðr   c                 óf  — | j         }| j        rt          g t          |Ž ¢| j        ‘R Ž \  }}}nt          |Ž \  }}}t          j        |||| j        j        | j        j        ¦  «        \  }}}}t          j
        t          j                             ||g¦  «        ¦  «        | _        t          |¦  «        S rB   )r  r\   r=   r‹   r9   r   r‘   re   r’   rË   rÌ   r$   r5   rÍ   r  rÔ   ©	rG   Úsr6   r7   r8   ÚvxsÚvysÚvzsÚviss	            r   r×   zPatch3D.do_3d_projection  s­   € ØŒOˆØÔð 	!Ý&Ð;­¨Q¨Ð;°´Ð;Ð;Ð;‰JˆB��B�Bå˜a˜‰JˆB��BÝ#Ô8¸¸RÀØ9=¼¼Ø9=¼Ô9PñRô RÑˆˆS�#�sõ ”z¥"¤%×"4Ò"4°c¸3°ZÑ"@Ô"@ÑAÔAˆŒÝ�3‰xŒxˆr   rs   )	rt   ru   rv   rw   rE   rF   r  r×   ry   rz   s   @r   r  r  à  s‡   ø€ € € € € ðð ð "$¨#¸%ð 5ð 5ð 5ð 5ð 5ð 5ð 5ð"&ð &ð &ð &ð*ð ð ð
ð 
ð 
ð 
ð 
ð 
ð 
r   r  c                   ó0   — e Zd ZdZddddœd„Zdd„Zd	„ Zd
S )ÚPathPatch3Dz
    3D PathPatch object.
    r   r"   Fr  c                óZ   — t          j        | fi |¤Ž |                      ||||¦  «         dS )aß  
        Parameters
        ----------
        path :
        zs : float
            The location along the *zdir* axis in 3D space to position the
            path patch.
        zdir : {'x', 'y', 'z', 3-tuple}
            Plane to plot path patch orthogonal to. Default: 'z'.
            See `.get_dir_vector` for a description of the values.
        axlim_clip : bool, default: False
            Whether to hide path patches with a point outside the axes view limits.
        N)r   rE   rF   )rG   r
   r8   r)   rH   rI   s         r   rE   zPathPatch3D.__init__%  s<   € õ 	Œ�tÐ&Ð&˜vÐ&Ð&Ð&Ø×Ò˜t R¨¨zÑ:Ô:Ð:Ð:Ð:r   r   c                 óf   — t                                | |j        |||¬¦  «         |j        | _        dS )a  
        Set the *z* position and direction of the path patch.

        Parameters
        ----------
        path :
        zs : float
            The location along the *zdir* axis in 3D space to position the
            path patch.
        zdir : {'x', 'y', 'z', 3-tuple}
            Plane to plot path patch orthogonal to. Default: 'z'.
            See `.get_dir_vector` for a description of the values.
        axlim_clip : bool, default: False
            Whether to hide path patches with a point outside the axes view limits.
        r  N)r  rF   rÚ   r¸   Ú_code3d)rG   r
   r8   r)   rH   s        r   rF   zPathPatch3D.set_3d_properties7  s;   € õ  	×!Ò! $¨¬¸"À4Ø-7ð 	"ñ 	9ô 	9ð 	9à”zˆŒˆˆr   c                 ór  — | j         }| j        rt          g t          |Ž ¢| j        ‘R Ž \  }}}nt          |Ž \  }}}t          j        |||| j        j        | j        j        ¦  «        \  }}}}t          j
        t          j                             ||g¦  «        | j        ¦  «        | _        t!          |¦  «        S rB   )r  r\   r=   r‹   r9   r   r‘   re   r’   rË   rÌ   r$   r5   rÍ   r  r  rÔ   r  s	            r   r×   zPathPatch3D.do_3d_projectionK  s±   € ØŒOˆØÔð 	!Ý&Ð;­¨Q¨Ð;°´Ð;Ð;Ð;‰JˆB��B�Bå˜a˜‰JˆB��BÝ#Ô8¸¸RÀØ9=¼¼Ø9=¼Ô9PñRô RÑˆˆS�#�sõ ”z¥"¤%×"4Ò"4°c¸3°ZÑ"@Ô"@À$Ä,ÑOÔOˆŒÝ�3‰xŒxˆr   Nrs   )rt   ru   rv   rw   rE   rF   r×   r   r   r   r  r     sc   € € € € € ðð ð $&¨C¸Eð ;ð ;ð ;ð ;ð ;ð$"ð "ð "ð "ð(
ð 
ð 
ð 
ð 
r   r  c                 óÒ   — |                       ¦   «         }|                      ¦   «         }|                     |¦  «        }t          |¦  «        r|d         nt	          j        g ¦  «        S )z2Return a list of vertices for the path of a patch.r   )Úget_patch_transformr  Úto_polygonsr'   r$   r%   )ÚpatchÚtransr
   Úpolygonss       r   Ú_get_patch_vertsr%  X  sV   € à×%Ò%Ñ'Ô'€EØ�>Š>ÑÔ€DØ×Ò Ñ&Ô&€HÝ˜h™-œ-Ð9ˆ8�AŒ;ˆ;­R¬X°b©\¬\Ð9r   c                 ól   — t          | ¦  «        }t          | _        |                      ||||¦  «         dS )z*Convert a `.Patch` to a `.Patch3D` object.N)r%  r  rW   rF   )r"  r"   r)   rH   r  s        r   Úpatch_2d_to_3dr'  `  s6   € å˜UÑ#Ô#€EÝ€E„OØ	×Ò˜E 1 d¨JÑ7Ô7Ð7Ð7Ð7r   c                 óÆ   — |                       ¦   «         }|                      ¦   «         }|                     |¦  «        }t          | _        |                      |||¦  «         dS )z2Convert a `.PathPatch` to a `.PathPatch3D` object.N)r  r   Útransform_pathr  rW   rF   )Ú	pathpatchr"   r)   r
   r#  rË   s         r   Úpathpatch_2d_to_3dr+  g  s]   € à×ÒÑÔ€DØ×)Ò)Ñ+Ô+€Eà× Ò  Ñ&Ô&€EÝ%€IÔØ×Ò  q¨$Ñ/Ô/Ð/Ð/Ð/r   c                   ól   ‡ — e Zd ZdZdddddœˆ fd„
Zd„ Zd	„ Zd
„ Zdd„Zˆ fd„Z	d„ Z
ˆ fd„Zˆ fd„Zˆ xZS )ÚPatch3DCollectionz%
    A collection of 3D patches.
    r   r"   TF©r8   r)   Ú
depthshaderH   c                óv   •— || _          t          ¦   «         j        |i |¤Ž |                      |||¦  «         dS )a¢  
        Create a collection of flat 3D patches with its normal vector
        pointed in *zdir* direction, and located at *zs* on the *zdir*
        axis. 'zs' can be a scalar or an array-like of the same length as
        the number of patches in the collection.

        Constructor arguments are the same as for
        :class:`~matplotlib.collections.PatchCollection`. In addition,
        keywords *zs=0* and *zdir='z'* are available.

        Also, the keyword argument *depthshade* is available to indicate
        whether to shade the patches in order to give the appearance of depth
        (default is *True*). This is typically desired in scatter plots.
        N)Ú_depthshaderR   rE   rF   ©rG   r8   r)   r/  rH   r‚   rI   rW   s          €r   rE   zPatch3DCollection.__init__v  sG   ø€ ð  &ˆÔØ�‰ŒÔ˜$Ð) &Ð)Ð)Ð)Ø×Ò˜r 4¨Ñ4Ô4Ð4Ð4Ð4r   c                 ó   — | j         S rB   ©r1  rN   s    r   Úget_depthshadez Patch3DCollection.get_depthshadeŠ  ó   € ØÔÐr   c                 ó"   — || _         d| _        dS ©zï
        Set whether depth shading is performed on collection members.

        Parameters
        ----------
        depthshade : bool
            Whether to shade the patches in order to give the appearance of
            depth.
        TN©r1  rZ   ©rG   r/  s     r   Úset_depthshadez Patch3DCollection.set_depthshade�  ó   € ð &ˆÔØˆŒ
ˆ
ˆ
r   c                 ó"   — || _         d| _        dS rå   ræ   rè   s     r   rê   zPatch3DCollection.set_sort_zposš  rë   r   c                 ó>  — |                       ¦   «          |                      ¦   «         }t          |¦  «        dk    r|j        \  }}ng }g }t	          ||t          j        |¦  «        |¦  «        | _        t          d¦  «        | _	        d| _
        || _        d| _        dS )aE  
        Set the *z* positions and direction of the patches.

        Parameters
        ----------
        zs : float or array of floats
            The location or locations to place the patches in the collection
            along the *zdir* axis.
        zdir : {'x', 'y', 'z'}
            Plane to plot patches orthogonal to.
            All patches must have the same direction.
            See `.get_dir_vector` for a description of the values.
        axlim_clip : bool, default: False
            Whether to hide patches with a vertex outside the axes view limits.
        r   rô   NT)Úupdate_scalarmappableÚget_offsetsr'   rÆ   rˆ   r$   Ú
atleast_1dÚ
_offsets3dÚsliceÚ_z_markers_idxÚ_vzsr\   rZ   ©rG   r8   r)   rH   Úoffsetsr6   r7   s          r   rF   z#Patch3DCollection.set_3d_propertiesŸ  s–   € ð$ 	×"Ò"Ñ$Ô$Ð$Ø×"Ò"Ñ$Ô$ˆÝˆw‰<Œ<˜!ÒÐØ”Y‰FˆB��àˆBØˆBÝ% b¨"­b¬m¸BÑ.?Ô.?ÀÑFÔFˆŒÝ# B™iœiˆÔØˆŒ	Ø%ˆÔØˆŒ
ˆ
ˆ
r   c                 óž  •— | j         rt          g | j        ¢| j        ‘R Ž \  }}}n| j        \  }}}t	          j        |||| j        j        | j        j        ¦  «        \  }}}}|| _        t          ¦   «          
                    t          j                             ||g¦  «        ¦  «         |j        dk    rt          |¦  «        S t          j        S ©Nr   )r\   r=   rB  r9   r   r‘   re   r’   rE  rR   Úset_offsetsr$   r5   rÍ   ÚsizerÔ   rb   )	rG   r6   r7   r8   r  r  r  r  rW   s	           €r   r×   z"Patch3DCollection.do_3d_projection¾  sÃ   ø€ ØÔð 	)Ý&ÐC¨¬ÐC¸¼ÐCÐCÐC‰JˆB��B�Bàœ‰JˆB��BÝ#Ô8¸¸RÀØ9=¼¼Ø9=¼Ô9PñRô RÑˆˆS�#�sð ˆŒ	Ý‰Œ×Ò�BœE×.Ò.°°S¨zÑ:Ô:Ñ;Ô;Ð;àŒ8�aŠ<ˆ<Ý�s‘8”8ˆOå”6ˆMr   c                 óÀ   — | j         �| j        rt          || j         ¦  «        n|}t          |¦  «        dk    r|| j                 }t          j        || j        ¦  «        S ©Nr   ©rE  r1  Ú_zalphar'   rD  ÚmcolorsÚto_rgba_arrayÚ_alpha©rG   Úcolor_arrays     r   Ú"_maybe_depth_shade_and_sort_colorsz4Patch3DCollection._maybe_depth_shade_and_sort_colorsÎ  óg   € ð ŒyÐ$¨Ô)9Ð$õ �K ¤Ñ+Ô+Ð+àð 	õ
 ˆ{ÑÔ˜aÒÐØ% dÔ&9Ô:ˆKÝÔ$ [°$´+Ñ>Ô>Ð>r   c                 ój   •— |                       t          ¦   «                              ¦   «         ¦  «        S rB   ©rU  rR   Úget_facecolor©rG   rW   s    €r   rY  zPatch3DCollection.get_facecolorØ  ó'   ø€ Ø×6Ò6µu±w´w×7LÒ7LÑ7NÔ7NÑOÔOÐOr   c                 óÆ   •— t          j        | j        d¦  «        r|                      ¦   «         S |                      t          ¦   «                              ¦   «         ¦  «        S ©NÚface©r   Ú
_str_equalÚ_edgecolorsrY  rU  rR   Úget_edgecolorrZ  s    €r   rb  zPatch3DCollection.get_edgecolorÛ  óS   ø€ õ Ô˜DÔ,¨fÑ5Ô5ð 	(Ø×%Ò%Ñ'Ô'Ð'Ø×6Ò6µu±w´w×7LÒ7LÑ7NÔ7NÑOÔOÐOr   r  )rt   ru   rv   rw   rE   r5  r;  rê   rF   r×   rU  rY  rb  ry   rz   s   @r   r-  r-  q  s   ø€ € € € € ðð ð
 ˜C¨D¸Uð5ð 5ð 5ð 5ð 5ð 5ð 5ð( ð  ð  ðð ð ðð ð ð
ð ð ð ð>ð ð ð ð ð ?ð ?ð ?ðPð Pð Pð Pð PðPð Pð Pð Pð Pð Pð Pð Pð Pr   r-  c                   ó¢   ‡ — e Zd ZdZdddddœˆ fd„
Zˆ fd„Zd	„ Zdd
„Zdˆ fd„	Zˆ fd„Z	d„ Z
d„ Zd„ Zeˆ fd„¦   «         Zd„ Zˆ fd„Zˆ fd„Zˆ xZS )ÚPath3DCollectionz#
    A collection of 3D paths.
    r   r"   TFr.  c                ó’   •— || _         d| _         t          ¦   «         j        |i |¤Ž |                      |||¦  «         d| _        dS )a�  
        Create a collection of flat 3D paths with its normal vector
        pointed in *zdir* direction, and located at *zs* on the *zdir*
        axis. 'zs' can be a scalar or an array-like of the same length as
        the number of paths in the collection.

        Constructor arguments are the same as for
        :class:`~matplotlib.collections.PathCollection`. In addition,
        keywords *zs=0* and *zdir='z'* are available.

        Also, the keyword argument *depthshade* is available to indicate
        whether to shade the patches in order to give the appearance of depth
        (default is *True*). This is typically desired in scatter plots.
        FN)r1  Ú_in_drawrR   rE   rF   Ú_offset_zorderedr2  s          €r   rE   zPath3DCollection.__init__é  sV   ø€ ð  &ˆÔØˆŒØ�‰ŒÔ˜$Ð) &Ð)Ð)Ð)Ø×Ò˜r 4¨Ñ4Ô4Ð4Ø $ˆÔÐÐr   c                 ó   •— |                       ¦   «         5  t          j        | d¬¦  «        5  t          ¦   «                              |¦  «         d d d ¦  «         n# 1 swxY w Y   d d d ¦  «         d S # 1 swxY w Y   d S )NT)rg  )Ú_use_zordered_offsetr   ri   rR   rj   )rG   rk   rW   s     €r   rj   zPath3DCollection.drawÿ  sú   ø€ Ø×&Ò&Ñ(Ô(ð 	'ð 	'ÝÔ" 4°$Ð7Ñ7Ô7ð 'ð 'Ý‘”—’˜XÑ&Ô&Ð&ð'ð 'ð 'ñ 'ô 'ð 'ð 'ð 'ð 'ð 'ð 'øøøð 'ð 'ð 'ð 'ð	'ð 	'ð 	'ñ 	'ô 	'ð 	'ð 	'ð 	'ð 	'ð 	'ð 	'ð 	'øøøð 	'ð 	'ð 	'ð 	'ð 	'ð 	's4   –A3­"AÁA3ÁA	ÁA3Á"A	Á#A3Á3A7Á:A7c                 ó"   — || _         d| _        dS rå   ræ   rè   s     r   rê   zPath3DCollection.set_sort_zpos  rë   r   c                 ó¶  — |                       ¦   «          |                      ¦   «         }t          |¦  «        dk    r|j        \  }}ng }g }|| _        t          ||t          j        |¦  «        |¦  «        | _        | j	        | _
        t          j        | j        ¦  «        | _        | j        \  }}}t          d¦  «        | _        d| _        || _        d| _        dS )a;  
        Set the *z* positions and direction of the paths.

        Parameters
        ----------
        zs : float or array of floats
            The location or locations to place the paths in the collection
            along the *zdir* axis.
        zdir : {'x', 'y', 'z'}
            Plane to plot paths orthogonal to.
            All paths must have the same direction.
            See `.get_dir_vector` for a description of the values.
        axlim_clip : bool, default: False
            Whether to hide paths with a vertex outside the axes view limits.
        r   rô   NT)r?  r@  r'   rÆ   Ú_zdirrˆ   r$   rA  rB  Ú_sizesÚ_sizes3dr%   Ú_linewidthsÚ_linewidths3drC  rD  rE  r\   rZ   rF  s          r   rF   z"Path3DCollection.set_3d_properties	  sÌ   € ð$ 	×"Ò"Ñ$Ô$Ð$Ø×"Ò"Ñ$Ô$ˆÝˆw‰<Œ<˜!ÒÐØ”Y‰FˆB��àˆBØˆBØˆŒ
Ý% b¨"­b¬m¸BÑ.?Ô.?ÀÑFÔFˆŒð œˆŒÝœX dÔ&6Ñ7Ô7ˆÔØ”_‰
ˆˆB�õ
 $ B™iœiˆÔØˆŒ	à%ˆÔØˆŒ
ˆ
ˆ
r   ç      R@c                 ól   •— t          ¦   «                              ||¦  «         | j        s	|| _        d S d S rB   )rR   Ú	set_sizesrg  ro  )rG   ÚsizesÚdpirW   s      €r   rt  zPath3DCollection.set_sizes;  s<   ø€ Ý‰Œ×Ò˜% Ñ%Ô%Ð%ØŒ}ð 	"Ø!ˆDŒMˆMˆMð	"ð 	"r   c                 ó˜   •— t          ¦   «                              |¦  «         | j        s t          j        | j        ¦  «        | _        d S d S rB   )rR   Úset_linewidthrg  r$   r%   rp  rq  )rG   ÚlwrW   s     €r   rx  zPath3DCollection.set_linewidth@  sJ   ø€ Ý‰Œ×Ò˜bÑ!Ô!Ð!ØŒ}ð 	<Ý!#¤¨$Ô*:Ñ!;Ô!;ˆDÔÐÐð	<ð 	<r   c                 ó   — | j         S rB   r4  rN   s    r   r5  zPath3DCollection.get_depthshadeE  r6  r   c                 ó"   — || _         d| _        dS r8  r9  r:  s     r   r;  zPath3DCollection.set_depthshadeH  r<  r   c                 ó  — | j         rt          g | j        ¢| j        ‘R Ž \  }}}n| j        \  }}}t	          j        |||| j        j        | j        j        ¦  «        \  }}}}t          j	         
                    |¦  «        d d d…         x}| _        || _        t          | j        ¦  «        dk    r| j        |         | _        t          | j        ¦  «        dk    r| j        |         | _        t%          j        | t          j	                             ||f¦  «        ¦  «         ||         }||         }||         }t          j	                             ||f¦  «        | _        |j        rt          j        |¦  «        nt          j        S )Nrô   r   )r\   r=   rB  r9   r   r‘   re   r’   r$   r5   ÚargsortrD  rE  r'   ro  rn  rq  rp  r   rJ  rÍ   rh  rK  rÔ   rb   )	rG   r6   r7   r8   r  r  r  r  Úz_markers_idxs	            r   r×   z!Path3DCollection.do_3d_projectionU  sj  € ØÔð 	)Ý&ÐC¨¬ÐC¸¼ÐCÐCÐC‰JˆB��B�Bàœ‰JˆB��BÝ#Ô8¸¸RÀØ9=¼¼Ø9=¼Ô9PñRô RÑˆˆS�#�sõ /1¬e¯mªm¸CÑ.@Ô.@ÀÀÀ2ÀÔ.FÐFˆ˜Ô+ØˆŒ	õ ˆtŒ}ÑÔ Ò!Ð!Øœ-¨Ô6ˆDŒKåˆtÔ!Ñ"Ô" QÒ&Ð&Ø#Ô1°-Ô@ˆDÔåÔ" 4­¬×);Ò);¸SÀ#¸JÑ)GÔ)GÑHÔHÐHð �-Ô ˆØ�-Ô ˆØ�-Ô ˆõ !#¤× 2Ò 2°C¸°:Ñ >Ô >ˆÔà!œhÐ2�rŒv�c‰{Œ{ˆ{­B¬FÐ2r   c              #   ó°   •K  — | j         €d V — d S | j        }t          ¦   «                              | j         ¦  «         	 d V — || _        d S # || _        w xY wrB   )rh  Ú_offsetsrR   rJ  )rG   Ú
old_offsetrW   s     €r   rj  z%Path3DCollection._use_zordered_offsetz  sm   øè è € àÔ Ð(àˆEˆEˆEˆEˆEð œˆJÝ‰GŒG×Ò Ô 5Ñ6Ô6Ð6ð+Ø���à *�”��ø 
�”Ð*Ð*Ð*Ð*s   ¿A Á	Ac                 óÀ   — | j         �| j        rt          || j         ¦  «        n|}t          |¦  «        dk    r|| j                 }t          j        || j        ¦  «        S rM  rN  rS  s     r   rU  z3Path3DCollection._maybe_depth_shade_and_sort_colorsˆ  rV  r   c                 ój   •— |                       t          ¦   «                              ¦   «         ¦  «        S rB   rX  rZ  s    €r   rY  zPath3DCollection.get_facecolor’  r[  r   c                 óÆ   •— t          j        | j        d¦  «        r|                      ¦   «         S |                      t          ¦   «                              ¦   «         ¦  «        S r]  r_  rZ  s    €r   rb  zPath3DCollection.get_edgecolor•  rc  r   r  )rr  )rt   ru   rv   rw   rE   rj   rê   rF   rt  rx  r5  r;  r×   r   rj  rU  rY  rb  ry   rz   s   @r   re  re  ä  sm  ø€ € € € € ðð ð
 ˜C¨D¸Uð%ð %ð %ð %ð %ð %ð %ð,'ð 'ð 'ð 'ð 'ð
ð ð ð
0ð 0ð 0ð 0ðd"ð "ð "ð "ð "ð "ð
<ð <ð <ð <ð <ð
 ð  ð  ðð ð ð#3ð #3ð #3ðJ ð+ð +ð +ð +ñ „^ð+ð?ð ?ð ?ðPð Pð Pð Pð PðPð Pð Pð Pð Pð Pð Pð Pð Pr   re  Tc                 óä   — t          | t          ¦  «        rt          | _        d| _        n!t          | t
          ¦  «        rt          | _        || _        d| _        |  	                    |||¦  «         dS )a/  
    Convert a `.PatchCollection` into a `.Patch3DCollection` object
    (or a `.PathCollection` into a `.Path3DCollection` object).

    Parameters
    ----------
    col : `~matplotlib.collections.PatchCollection` or `~matplotlib.collections.PathCollection`
        The collection to convert.
    zs : float or array of floats
        The location or locations to place the patches in the collection along
        the *zdir* axis. Default: 0.
    zdir : {'x', 'y', 'z'}
        The axis in which to place the patches. Default: "z".
        See `.get_dir_vector` for a description of the values.
    depthshade : bool, default: True
        Whether to shade the patches to give a sense of depth.
    axlim_clip : bool, default: False
        Whether to hide patches with a vertex outside the axes view limits.
    NF)
Ú
isinstancer   re  rW   rh  r   r-  r1  rg  rF   )rß   r8   r)   r/  rH   s        r   Úpatch_collection_2d_to_3dr‡  ž  sm   € õ* �#•~Ñ&Ô&ð *Ý(ˆŒØ#ˆÔÐÝ	�C�Ñ	)Ô	)ð *Ý)ˆŒØ €C„OØ€C„LØ×Ò˜"˜d JÑ/Ô/Ð/Ð/Ð/r   c                   óâ   ‡ — e Zd ZdZdddddœˆ fd„
Zej        ej        ej        dœZ	d„ Z
 ej        d	¦  «        d
„ ¦   «         Zd„ Zdˆ fd„	Zd„ Zdd„Zd„ Zd„ Zˆ fd„Zˆ fd„Zd„ Zd„ Zd„ Zˆ xZS )ÚPoly3DCollectiona÷  
    A collection of 3D polygons.

    .. note::
        **Filling of 3D polygons**

        There is no simple definition of the enclosed surface of a 3D polygon
        unless the polygon is planar.

        In practice, Matplotlib fills the 2D projection of the polygon. This
        gives a correct filling appearance only for planar polygons. For all
        other polygons, you'll find orientations in which the edges of the
        polygon intersect in the projection. This will lead to an incorrect
        visualization of the 3D area.

        If you need filled areas, it is recommended to create them via
        `~mpl_toolkits.mplot3d.axes3d.Axes3D.plot_trisurf`, which creates a
        triangulation and thus generates consistent surfaces.
    ÚaverageFN)ÚzsortÚshadeÚlightsourcerH   c                ó:  •— |rzt          |¦  «        }|                     dd¦  «        }	|	�t          |	||¦  «        |d<   |                     dd¦  «        }
|
�t          |
||¦  «        |d<   |	€|
€t          d¦  «        ‚ t	          ¦   «         j        |g|¢R i |¤Ž t          |t          j        ¦  «        r|j	        dk    rt          d¦  «        ‚n(t          d„ |D ¦   «         ¦  «        rt          d¦  «        ‚|                      |¦  «         d| _        || _        dS )a™  
        Parameters
        ----------
        verts : list of (N, 3) array-like
            The sequence of polygons [*verts0*, *verts1*, ...] where each
            element *verts_i* defines the vertices of polygon *i* as a 2D
            array-like of shape (N, 3).
        zsort : {'average', 'min', 'max'}, default: 'average'
            The calculation method for the z-order.
            See `~.Poly3DCollection.set_zsort` for details.
        shade : bool, default: False
            Whether to shade *facecolors* and *edgecolors*. When activating
            *shade*, *facecolors* and/or *edgecolors* must be provided.

            .. versionadded:: 3.7

        lightsource : `~matplotlib.colors.LightSource`, optional
            The lightsource to use when *shade* is True.

            .. versionadded:: 3.7

        axlim_clip : bool, default: False
            Whether to hide polygons with a vertex outside the view limits.

        *args, **kwargs
            All other parameters are forwarded to `.PolyCollection`.

        Notes
        -----
        Note that this class does a bit of magic with the _facecolors
        and _edgecolors properties.
        Ú
facecolorsNÚ
edgecolorszCYou must provide facecolors, edgecolors, or both for shade to work.r#   z)verts must be a list of (N, 3) array-likec              3   ó`   K  — | ])}t          t          j        |¦  «        ¦  «        d k    V — Œ*dS )rQ   N)r'   r$   rñ   )r¡   Úverts     r   ú	<genexpr>z,Poly3DCollection.__init__.<locals>.<genexpr>
  s7   è è € Ð>Ð>°•3•r”x ‘~”~Ñ&Ô&¨!Ò+Ð>Ð>Ð>Ð>Ð>Ð>r   )Ú_generate_normalsÚgetÚ_shade_colorsr(   rR   rE   r†  r$   ÚndarrayÚndimÚanyÚ	set_zsortÚ_codes3dr\   )rG   r  r‹  rŒ  r�  rH   r‚   rI   Únormalsr�  r�  rW   s              €r   rE   zPoly3DCollection.__init__Ò  s^  ø€ ðD ð 	&Ý'¨Ñ.Ô.ˆGØŸš L°$Ñ7Ô7ˆJØÐ%Ý'4Ø ¨ñ(ô (��|Ñ$ð  Ÿš L°$Ñ7Ô7ˆJØÐ%Ý'4Ø ¨ñ(ô (��|Ñ$ð Ð! jÐ&8Ý ð%ñ&ô &ð &ð 	�‰ŒÔ˜Ð0 Ð0Ð0Ð0¨Ð0Ð0Ð0Ý�e�RœZÑ(Ô(ð 	NØŒz˜QŠˆÝ Ð!LÑMÔMÐMð õ Ð>Ð>¸Ð>Ñ>Ô>Ñ>Ô>ð NÝ Ð!LÑMÔMÐMØ�Š�uÑÔÐØˆŒØ%ˆÔÐÐr   )rŠ  rÔ   Úmaxc                 óF   — | j         |         | _        d| _        d| _        dS )a  
        Set the calculation method for the z-order.

        Parameters
        ----------
        zsort : {'average', 'min', 'max'}
            The function applied on the z-coordinates of the vertices in the
            viewer's coordinate system, to determine the z-order.
        NT)Ú_zsort_functionsÚ
_zsortfuncrç   rZ   )rG   r‹  s     r   rš  zPoly3DCollection.set_zsort  s%   € ð Ô/°Ô6ˆŒØˆŒØˆŒ
ˆ
ˆ
r   z3.10c                 ó,   — |                       |¦  «        S rB   )Ú_get_vector)rG   r  s     r   Ú
get_vectorzPoly3DCollection.get_vector$  s   € à×Ò 
Ñ+Ô+Ð+r   c                 ó„  — t          |¦  «        rt          j        |¦  «        j        \  }}}ng g g }}}t          j        t          |¦  «        ¦  «        }t          j        ||||g¦  «        | _        dgt          j        d„ |D ¦   «         ¦  «        ¢}g t          t          |dd…         |dd…         ¦  «        ¢| _
        dS )zOptimize points for projection.r   c                 ó,   — g | ]}t          |¦  «        ‘ŒS r   )r'   rò   s     r   r£   z0Poly3DCollection._get_vector.<locals>.<listcomp>1  s   € Ð!IÐ!IÐ!I°7¥# g¡,¤,Ð!IÐ!IÐ!Ir   Nrô   r   )r'   r$   rø   rÆ   Úonesr%   Ú_vecrú   ÚmaprC  Ú
_segslices)rG   r  r6   r7   r8   r¦  Úindicess          r   r¢  zPoly3DCollection._get_vector(  s¸   € åˆz‰?Œ?ð 	$Ýœ :Ñ.Ô.Ô0‰JˆB��B�Bà˜R �B�ˆBÝŒw•s˜2‘w”wÑÔˆÝ”H˜b " b¨$Ð/Ñ0Ô0ˆŒ	àÐK•r”yÐ!IÐ!I¸jÐ!IÑ!IÔ!IÑJÔJÐKˆØB�C¥ w¨s°¨s¤|°W¸Q¸R¸R´[ÑAÔAÐBˆŒˆˆr   Tc                 ó„   •— |                       |¦  «         t          ¦   «                              g d¦  «         || _        dS )a¾  
        Set 3D vertices.

        Parameters
        ----------
        verts : list of (N, 3) array-like
            The sequence of polygons [*verts0*, *verts1*, ...] where each
            element *verts_i* defines the vertices of polygon *i* as a 2D
            array-like of shape (N, 3).
        closed : bool, default: True
            Whether the polygon should be closed by adding a CLOSEPOLY
            connection at the end.
        FN)r¢  rR   Ú	set_vertsÚ_closed)rG   r  ÚclosedrW   s      €r   r¬  zPoly3DCollection.set_verts4  s>   ø€ ð 	×Ò˜ÑÔÐå‰Œ×Ò˜"˜eÑ$Ô$Ð$ØˆŒˆˆr   c                 óB   — |                       |d¬¦  «         || _        dS )z Set 3D vertices with path codes.F)r®  N)r¬  r›  )rG   r  r¸   s      r   Úset_verts_and_codesz$Poly3DCollection.set_verts_and_codesG  s%   € ð 	�Š�u UˆÑ+Ô+Ð+àˆŒˆˆr   c                 ó
  — |                       ¦   «          d | _        |                      d¦  «         t          j        | ¦  «        | _        t          j        | ¦  «        | _        t          j        | ¦  «        | _	        d| _
        d S )NrŠ  T)r?  rç   rš  r   rY  Ú_facecolor3drb  Ú_edgecolor3dÚ	get_alphaÚ_alpha3drZ   )rG   rH   s     r   rF   z"Poly3DCollection.set_3d_propertiesO  sr   € ð 	×"Ò"Ñ$Ô$Ð$ØˆŒØ�Š�yÑ!Ô!Ð!Ý*Ô8¸Ñ>Ô>ˆÔÝ*Ô8¸Ñ>Ô>ˆÔÝ&Ô0°Ñ6Ô6ˆŒØˆŒ
ˆ
ˆ
r   c                 ó"   — || _         d| _        dS rå   ræ   rè   s     r   rê   zPoly3DCollection.set_sort_zposZ  rë   r   c           
      óÜ  ‡ ‡‡‡— ‰ j         �:‰                      ¦   «          ‰ j        r‰ j        ‰ _        ‰ j        r‰ j        ‰ _        ‰ j        r±t          g ‰ j
        dd…         ¢‰ j        ‘R Ž \  }}}‰ j
        j        d         dk    rTt          j                             |j        ‰ j
        d         ¦  «        }t          j                             ||||g¦  «        }n*t          j                             |||g¦  «        }n‰ j
        }t%          j        |‰ j        j        ¦  «        \  ŠŠŠˆˆˆfd„‰ j        D ¦   «         }‰ j        }‰ j        }t-          |¦  «        t-          |¦  «        k    r$|                     t-          |¦  «        d¬¦  «        }t-          |¦  «        t-          |¦  «        k    r:t-          |¦  «        dk    r|}n$|                     t-          |¦  «        d¬¦  «        }|rUt1          ˆ fd„t3          t5          |||¦  «        ¦  «        D ¦   «         d„ d	¬
¦  «        }	t5          |	Ž \  }
}‰ _        ‰ _        }n6g }t          j        d¦  «        ‰ _        t          j        d¦  «        ‰ _        g }‰ j        �%ˆ fd„|D ¦   «         }t?          j         ‰ ||¦  «         nt?          j!        ‰ |‰ j"        ¦  «         t-          ‰ j        ¦  «        t-          |¦  «        k    r‰ j        ‰ _        ‰ j#        �Nt          j        dgdg‰ j#        gdgg¦  «        }t%          j        |‰ j        j        ¦  «        }|d         d         S ‰j$        dk    rt          j%        ‰¦  «        S t          j&        S )z<
        Perform the 3D projection for this object.
        Nr   r#   é   c                 ó>   •— g | ]}‰|         ‰|         ‰|         f‘ŒS r   r   )r¡   ÚslÚtxsÚtysÚtzss     €€€r   r£   z5Poly3DCollection.do_3d_projection.<locals>.<listcomp>z  s,   ø€ ÐIÐIÐI°2�C˜”G˜S œW c¨"¤gÐ.ÐIÐIÐIr   ©Úaxisc              3   óª   •K  — | ]M\  }\  \  }}}}}‰                      |j        ¦  «        t          j                             ||g¦  «        |||fV — ŒNd S rB   )r   Údatar$   r5   rÍ   )r¡   Úidxr6   r7   r8   ÚfcÚecrG   s          €r   r“  z4Poly3DCollection.do_3d_projection.<locals>.<genexpr>Š  sv   øè è € ð ;ð ;Ù0�SÑ0™<˜B  B¨¨Rð —/’/ "¤'Ñ*Ô*­B¬E×,>Ò,>ÀÀB¸xÑ,HÔ,HÈ"ÈbÐRUÐVð ;ð ;ð ;ð ;ð ;ð ;r   c                 ó   — | d         S rI  r   )r    s    r   ú<lambda>z3Poly3DCollection.do_3d_projection.<locals>.<lambda>�  s
   € ˜a œd€ r   T)ÚkeyÚreverse©r   r¸  c                 ó*   •— g | ]}‰j         |         ‘ŒS r   )r›  )r¡   rÂ  rG   s     €r   r£   z5Poly3DCollection.do_3d_projection.<locals>.<listcomp>˜  s    ø€ Ð8Ð8Ð8¨C�T”] 3Ô'Ð8Ð8Ð8r   r   rQ   )'Ú_Ar?  Ú_face_is_mappedÚ_facecolorsr²  Ú_edge_is_mappedra  r³  r\   r=   r§  r9   rñ   r$   r5   Úmasked_wherer,   r%   r   Ú_proj_transform_vecre   r©  r'   ÚrepeatÚsortedÚ	enumerater‹   Ú_facecolors2dÚ_edgecolors2dÚemptyr›  r   r°  r¬  r­  rç   rK  rÔ   rb   )rG   r6   r7   r8   Úw_maskedÚvecÚxyzlistÚcfaceÚcedgeÚz_segments_2drÄ   rÿ   Úidxsr¸   ÚzvecÚztransr»  r¼  r½  s   `               @@@r   r×   z!Poly3DCollection.do_3d_projection_  s\  øøøø€ ð Œ7Ðð ×&Ò&Ñ(Ô(Ð(ØÔ#ð 5Ø$(Ô$4�Ô!ØÔ#ð 5Ø$(Ô$4�Ô!ØÔð 	Ý&ÐB¨¬	°!°A°#¬ÐB¸¼	ÐBÐBÐB‰JˆB��BØŒyŒ˜qÔ! QÒ&Ð&Ýœ5×-Ò-¨b¬g°t´yÀ´|ÑDÔD�Ý”e—k’k 2 r¨2¨xÐ"8Ñ9Ô9��å”e—k’k 2 r¨2 ,Ñ/Ô/��à”)ˆCÝÔ2°3¸¼	¼ÑDÔD‰ˆˆS�#ØIÐIÐIÐIÐIÐI¸¼ÐIÑIÔIˆð Ô!ˆØÔ!ˆÝˆu‰:Œ:�˜W™œÒ%Ð%Ø—L’L¥ W¡¤°A�LÑ6Ô6ˆEÝˆu‰:Œ:�˜W™œÒ%Ð%Ý�5‰zŒz˜QŠˆØ��àŸš¥S¨¡\¤\¸˜Ñ:Ô:�àð 	å"ð;ð ;ð ;ð ;å�c '¨5°%Ñ8Ô8Ñ9Ô9ð;ñ ;ô ;ð #�N¨Dð	2ñ 2ô 2ˆMõ �]Ð#ñ IˆAˆ{˜DÔ.°Ô0BÀDÀDð ˆKÝ!#¤¨&Ñ!1Ô!1ˆDÔÝ!#¤¨&Ñ!1Ô!1ˆDÔØˆDàŒ=Ð$Ø8Ð8Ð8Ð8°4Ð8Ñ8Ô8ˆEÝÔ.¨t°[À%ÑHÔHÐHÐHåÔ$ T¨;¸¼ÑEÔEÐEåˆtÔ Ñ!Ô!¥S¨¡Z¤ZÒ/Ð/Ø!%Ô!2ˆDÔð Œ?Ð&Ý”8˜a˜S 1 #¨¬Ð'8¸1¸#Ð>Ñ?Ô?ˆDÝÔ/°°d´i´kÑBÔBˆFØ˜!”9˜Q”<ÐØŒX˜Š\ˆ\õ ”6˜#‘;”;Ðå”6ˆMr   c                 ó|   •— t          ¦   «                              |¦  «         t          j        | ¦  «        | _        d S rB   )rR   Úset_facecolorr   rY  r²  ©rG   r   rW   s     €r   rá  zPoly3DCollection.set_facecolor­  ó4   ø€ å‰Œ×Ò˜fÑ%Ô%Ð%Ý*Ô8¸Ñ>Ô>ˆÔÐÐr   c                 ó|   •— t          ¦   «                              |¦  «         t          j        | ¦  «        | _        d S rB   )rR   Úset_edgecolorr   rb  r³  râ  s     €r   rå  zPoly3DCollection.set_edgecolor²  rã  r   c                 ó`  — t           j                             | |¦  «         	 t          j        | j        | j        ¦  «        | _        n# t          t          t          f$ r Y nw xY w	 t          j        | j
        | j        ¦  «        | _        n# t          t          t          f$ r Y nw xY wd| _        d S )NT)r   ÚArtistÚ	set_alpharP  rQ  r²  rR  ÚAttributeErrorÚ	TypeErrorÚ
IndexErrorr³  ra  rZ   )rG   Úalphas     r   rè  zPoly3DCollection.set_alpha·  sÁ   € åŒ×Ò  eÑ,Ô,Ð,ð	Ý 'Ô 5ØÔ! 4¤;ñ!0ô !0ˆDÔÐøå¥	­:Ð6ð 	ð 	ð 	ØˆDð	øøøð	Ý&Ô4ØÔ% t¤{ñ 4ô  4ˆDÔÐøå¥	­:Ð6ð 	ð 	ð 	ØˆDð	øøøàˆŒ
ˆ
ˆ
s#   ¢$A ÁA!Á A!Á%$B
 Â
B$Â#B$c                 óÂ   — t          | d¦  «        s7| j                             ¦   «         | j        _        |                      ¦   «          t          j        | j        ¦  «        S )NrÔ  )r  r9   r  re   r×   r$   ÚasarrayrÔ  rN   s    r   rY  zPoly3DCollection.get_facecolorÆ  óR   € õ �t˜_Ñ-Ô-ð 	$Øœ)×,Ò,Ñ.Ô.ˆDŒIŒKØ×!Ò!Ñ#Ô#Ð#ÝŒz˜$Ô,Ñ-Ô-Ð-r   c                 óÂ   — t          | d¦  «        s7| j                             ¦   «         | j        _        |                      ¦   «          t          j        | j        ¦  «        S )NrÕ  )r  r9   r  re   r×   r$   rî  rÕ  rN   s    r   rb  zPoly3DCollection.get_edgecolorÎ  rï  r   )Tr  )rt   ru   rv   rw   rE   r$   rŠ  rÔ   r�  rŸ  rš  r   Ú
deprecatedr£  r¢  r¬  r°  rF   rê   r×   rá  rå  rè  rY  rb  ry   rz   s   @r   r‰  r‰  ½  s‚  ø€ € € € € ðð ð( ,5¸EØ!¨eð<&ð <&ð <&ð <&ð <&ð <&ð <&ð~ ”:ØŒvØŒvðð Ððð ð ð €T„_�VÑÔð,ð ,ñ Ôð,ð
Cð 
Cð 
Cðð ð ð ð ð ð&ð ð ð	ð 	ð 	ð 	ðð ð ð
Lð Lð Lð\?ð ?ð ?ð ?ð ?ð
?ð ?ð ?ð ?ð ?ð
ð ð ð.ð .ð .ð.ð .ð .ð .ð .ð .ð .r   r‰  c                 óÌ   — t          |                      ¦   «         ||¦  «        \  }}t          | _        |                      ||¦  «         |                      ¦   «          || _        dS )aì  
    Convert a `.PolyCollection` into a `.Poly3DCollection` object.

    Parameters
    ----------
    col : `~matplotlib.collections.PolyCollection`
        The collection to convert.
    zs : float or array of floats
        The location or locations to place the polygons in the collection along
        the *zdir* axis. Default: 0.
    zdir : {'x', 'y', 'z'}
        The axis in which to place the patches. Default: 'z'.
        See `.get_dir_vector` for a description of the values.
    N)r¾   rÜ   r‰  rW   r°  rF   r\   )rß   r8   r)   rH   Úsegments_3dr¸   s         r   Úpoly_collection_2d_to_3drô  ×  sa   € õ :Ø�MŠM‰OŒO˜R ñ'ô 'Ñ€K�å$€C„MØ×Ò˜K¨Ñ/Ô/Ð/Ø×ÒÑÔÐØ €C„O€O€Or   c                 ót   — |dk    r|| |fS |dk    r| ||fS |d         dk    rt          | |||¦  «        S | ||fS )zñ
    Reorder coordinates so that 2D *xs*, *ys* can be plotted in the plane
    orthogonal to *zdir*. *zdir* is normally 'x', 'y' or 'z'. However, if
    *zdir* starts with a '-' it is interpreted as a compensation for
    `rotate_axes`.
    r    r!   r   ú-)Úrotate_axes©r6   r7   r8   r)   s       r   rˆ   rˆ   î  s[   € ð ˆs‚{€{Ø�2�rˆzÐØ	�ŠˆØ�2�rˆzÐØ	ˆaŒ�CŠˆÝ˜2˜r 2 tÑ,Ô,Ð,à�2�rˆzÐr   c                 ó0   — |dv r||| fS |dv r|| |fS | ||fS )zØ
    Reorder coordinates so that the axes are rotated with *zdir* along
    the original z axis. Prepending the axis with a '-' does the
    inverse transform, so *zdir* can be 'x', '-x', 'y', '-y', 'z' or '-z'.
    )r    z-y)z-xr!   r   rø  s       r   r÷  r÷  ÿ  s>   € ð ˆ{ÐÐØ�2�rˆzÐØ	�Ð	Ð	Ø�2�rˆzÐà�2�rˆzÐr   c                 ó¶  — t          | ¦  «        dk    st          |¦  «        dk    rt          j        d¦  «        S t          t	          |¦  «        t          |¦  «        ¦  «        }d ||¦  «        dz  z
  }t          j        t          j        | ¦  «        t          |¦  «        df¦  «        }t          j	        |dd…dd…f         |dd…df         |z  g¦  «        S )z7Modify the alphas of the color list according to depth.r   rÉ  r   gffffffæ?r¸  Nr#   )
r'   r$   Úzerosr   rÔ   r�  r‡   rP  rQ  rÍ   )r   r8   ÚnormÚsatsÚrgbas        r   rO  rO    sÀ   € õ ˆ6�{„{�aÒÐ�3˜r™7œ7 aš<˜<ÝŒx˜ÑÔÐÝ•S˜‘W”W�c "™gœgÑ&Ô&€DØˆtˆt�B‰xŒx˜#‰~Ñ€DÝŒ?�7Ô0°Ñ8Ô8½3¸r¹7¼7ÀA¸,ÑGÔG€DÝŒ?˜D    B Q B œK¨¨a¨a¨a°¨d¬°dÑ):Ð;Ñ<Ô<Ð<r   ç:Œ0âŽyE>c                 óŠ  — t          j        | ¦  «        t          j        |¦  «        t          j        |¦  «        }}} t          j        | ||g¦  «        }|t          j        |¦  «                             d¬¦  «                  }t          j        |d¬¦  «        }t          |¦  «        dk    rdS ||d         z
  dd…         }|t           j                             |d¬¦  «        dd…t           j	        f         z  }t          j        |d¬¦  «        }t          |¦  «        dk    rdS t           j                             t          j
        |d         |dd…         ¦  «        d¬¦  «        }t          j        t          j        |d|¬¦  «        ¦  «        d         dz   }t          j        ||d¬¦  «        }t          |¦  «        dk    rdS t          j
        |d         |d         ¦  «        }|t           j                             |¦  «        z  }t          j        ||                     ¦   «         ¦  «        }	t          j        |	d|¬¦  «        S )	a  
    Check if all points are on the same plane. Note that NaN values are
    ignored.

    Parameters
    ----------
    xs, ys, zs : array-like
        The x, y, and z coordinates of the points.
    atol : float, default: 1e-8
        The tolerance for the equality check.
    r   r¾  r   r#   TNrQ   )Úatol)r$   rî  rÍ   Úisnanr™  Úuniquer'   Úlinalgrü  ÚnewaxisÚcrossÚwhereÚiscloseÚdeleteÚdotÚ	transposeÚallclose)
r6   r7   r8   r  rö   rÃ   Úcross_normsÚzero_cross_normsÚnÚdotss
             r   Ú_all_points_on_planer    sâ  € õ ”˜B‘”¥¤¨B¡¤µ´¸B±´ˆBˆ€BÝŒ_˜b " b˜\Ñ*Ô*€FØ•R”X˜fÑ%Ô%×)Ò)¨qÐ)Ñ1Ô1Ð1Ô2€FåŒY�v AÐ&Ñ&Ô&€FÝ
ˆ6�{„{�aÒÐØˆtà
�6˜!”9Ñ
˜a˜b˜bÔ	!€BØ	�bŒi�nŠn˜R aˆnÑ(Ô(¨¨¨­B¬J¨Ô7Ñ	7€Bå	Œ�2˜AÐ	Ñ	Ô	€BÝ
ˆ2�w„w�!‚|€|Øˆtå”)—.’.¥¤¨"¨Q¬%°°A°B°B´Ñ!8Ô!8¸q�.ÑAÔA€KÝ”x¥¤
¨;¸ÀÐ EÑ EÔ EÑFÔFÀqÔIÈAÑMÐÝ	Œ�2Ð'¨aÐ	0Ñ	0Ô	0€BÝ
ˆ2�w„w�!‚|€|Øˆtå
Œ��A”˜˜1œÑÔ€AØ	�BŒI�NŠN˜1ÑÔÑ€Aõ Œ6�!�R—\’\‘^”^Ñ$Ô$€DÝŒ;�t˜Q TÐ*Ñ*Ô*Ð*r   c                 ó   — t          | t          j        ¦  «        rS| j        d         }d|dz  d|z  dz  }}}| d|dd…f         | d|dd…f         z
  }| d|dd…f         | d|dd…f         z
  }nÍt          j        t          | ¦  «        df¦  «        }t          j        t          | ¦  «        df¦  «        }t          | ¦  «        D ]w\  }}t          |¦  «        }t          j        |¦  «        }d|dz  d|z  dz  }}}||dd…f         ||dd…f         z
  ||dd…f<   ||dd…f         ||dd…f         z
  ||dd…f<   Œxt          j        ||¦  «        S )aA  
    Compute the normals of a list of polygons, one normal per polygon.

    Normals point towards the viewer for a face with its vertices in
    counterclockwise order, following the right hand rule.

    Uses three points equally spaced around the polygon. This method assumes
    that the points are in a plane. Otherwise, more than one shade is required,
    which is not supported.

    Parameters
    ----------
    polygons : list of (M_i, 3) array-like, or (..., M, 3) array-like
        A sequence of polygons to compute normals for, which can have
        varying numbers of vertices. If the polygons all have the same
        number of vertices and array is passed, then the operation will
        be vectorized.

    Returns
    -------
    normals : (..., 3) array
        A normal vector estimated for the polygon.
    éþÿÿÿr   r#   rQ   .N)	r†  r$   r—  rñ   rÖ  r'   rÓ  rî  r  )	r$  r  Úi1Úi2Úi3Úv1Úv2Úpoly_iÚpss	            r   r”  r”  D  sƒ  € õ0 �(�BœJÑ'Ô'ð 2ð ŒN˜2ÔˆØ˜˜1™˜a ™c 1™f�ˆBˆØ�c˜2˜q˜q˜q�jÔ! H¨S°"°a°a°a¨ZÔ$8Ñ8ˆØ�c˜2˜q˜q˜q�jÔ! H¨S°"°a°a°a¨ZÔ$8Ñ8ˆˆõ ŒX•s˜8‘}”} aÐ(Ñ)Ô)ˆÝŒX•s˜8‘}”} aÐ(Ñ)Ô)ˆÝ# HÑ-Ô-ð 	2ð 	2‰JˆF�BÝ�B‘”ˆAÝ”˜B‘”ˆBØ˜A˜q™D ! A¡# q¡&�B�ˆBØ˜r 1 1 1˜uœI¨¨2¨q¨q¨q¨5¬	Ñ1ˆBˆv�q�q�qˆy‰MØ˜r 1 1 1˜uœI¨¨2¨q¨q¨q¨5¬	Ñ1ˆBˆv�q�q�qˆy‰MˆMÝŒ8�B˜ÑÔÐr   c                 óš  ‡‡	— |€t          j        dd¬¦  «        }t          j        d¬¦  «        5  |t          j                             |dd¬	¦  «        z  |j        z  }ddd¦  «         n# 1 swxY w Y   t          j        |¦  «         }|                     ¦   «         r‡t          j	        d
d¦  «        Št          j	        dd¦  «        j
        Š	ˆˆ	fd„}d|| <   t          j        | ¦  «        } | dd…df         } ||¦  «        dd…t          j        f         | z  }||dd…df<   n&t          j        | ¦  «                             ¦   «         }|S )zÆ
    Shade *color* using normal vectors given by *normals*,
    assuming a *lightsource* (using default position if not given).
    *color* can also be an array of the same length as *normals*.
    Néá   gà-� x3@)ÚazdegÚaltdegÚignore)Úinvalidr   T)r¿  Úkeepdimsrô   g333333Ó?c                 ó,   •—  ‰ ‰| ¦  «        ¦  «        S rB   r   )r    Úin_normÚout_norms    €€r   rü  z_shade_colors.<locals>.norm„  s   ø€ Ø�8˜G˜G A™JœJÑ'Ô'Ð'r   r   r#   )rP  ÚLightSourcer$   Úerrstater  rü  Ú	directionr  r™  r   ÚinverserQ  r  rc   Úcopy)
Úcolorrœ  r�  rŒ  r,   rü  rì  r   r#  r$  s
           @@r   r–  r–  p  s�  øø€ ð ÐåÔ)°¸GÐDÑDÔDˆå	Œ˜XÐ	&Ñ	&Ô	&ð *ð *Ø�BœIŸNšN¨7¸ÀT˜NÑJÔJÑJØÔ(ñ)ˆð*ð *ð *ñ *ô *ð *ð *ð *ð *ð *ð *øøøð *ð *ð *ð *õ ŒH�U‰OŒOÐ€Dà‡x‚x�z„zð -åÔ# B¨Ñ*Ô*ˆÝÔ$ S¨!Ñ,Ô,Ô4ˆð	(ð 	(ð 	(ð 	(ð 	(ð 	(ð ˆˆtˆe‰åÔ% eÑ,Ô,ˆð �a�a�a˜�d”ˆØ��e‘”˜Q˜Q˜Q¥¤
˜]Ô+¨eÑ3ˆØˆˆqˆqˆq�!ˆt‰ˆå”˜uÑ%Ô%×*Ò*Ñ,Ô,ˆà€Ms   °.A*Á*A.Á1A.rs   )r   r"   )r   r"   TF)rÿ  rB   )?rw   rf   Únumpyr$   Ú
contextlibr   Ú
matplotlibr   r   r   r   rP  r   r	   rC   r
   rË   Úmatplotlib.collectionsr   r   r   r   r   Úmatplotlib.colorsr   Úmatplotlib.patchesr   r@   r   r   r   r*   r=   rD   r?   r}   ÚLine2Dr   rš   r«   r²   r¹   r¾   rÀ   rà   râ   r  r  r  r%  r'  r+  r-  re  r‡  r‰  rô  rˆ   r÷  rO  r  r”  r–  r   r   r   ú<module>r2     s‰  ðð
ð ð
 €€€à Ð Ð Ð à %Ð %Ð %Ð %Ð %Ð %ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ðQð Qð Qð Qð Qð Qð Qð Qð Qð Qð Qð Qð Qð Qà 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð ðð ð ðð ð ðOð Oð OðD+ð +ð +ð8dð dð dð dð dˆUŒZñ dô dð dðN/ð /ð /ð /ð$cð cð cð cð cˆUŒ\ñ cô cð cðL1ð 1ð 1ð 1ð&ð ð ð ðð ð ð ðð ð ð ð'ð 'ð 'ð 'ð,ð ,ð ,ð ,ð ,�:ñ ,ô ,ð ,ð 
!ð 
!ð 
!ð 
!ð(ð (ð (ð (ð (�~ñ (ô (ð (ðV!ð !ð !ð !ð=ð =ð =ð =ð =ˆeñ =ô =ð =ð@5ð 5ð 5ð 5ð 5�'ñ 5ô 5ð 5ðp:ð :ð :ð8ð 8ð 8ð 8ð0ð 0ð 0ð 0ðpPð pPð pPð pPð pP˜ñ pPô pPð pPðfwPð wPð wPð wPð wP�~ñ wPô wPð wPðt0ð 0ð 0ð 0ð>W.ð W.ð W.ð W.ð W.�~ñ W.ô W.ð W.ðt!ð !ð !ð !ð.ð ð ð"ð ð ð=ð =ð =ð&+ð &+ð &+ð &+ðR)ð )ð )ðX#ð #ð #ð #ð #ð #r   