§
    õŽ’j’W  ã                   ó  — d Z ddlmZ ddlZddlZddlZddlmZ d„ Z	d„ Z
 ed¬¦  «        d	„ ¦   «         Z G d
„ de¦  «        Zd„ Zd„ Zd„ Zd„ Z	 d!d„Z G d„ d¦  «        Z	 d"d„Zd#d„Zd„ Zd„ Zd$d„Zd„ Zd„ Zd%d „ZdS )&uP   
A module providing some utility functions regarding BÃ©zier path manipulation.
é    )Ú	lru_cacheN)Ú_apic                 ó˜  — t          |¦  «        dk     rft          |¦  «        dk     rt          j        g ¦  «        S |  |z  }d|cxk    rdk    rn nt          j        |g¦  «        nt          j        g ¦  «        S ||z  d|z  | z  z
  }|dk     rt          j        g ¦  «        S t          j        |¦  «        }|dk    r	d||z   z  }nd||z
  z  }g }t          |¦  «        dk    r|                     | |z  ¦  «         t          |¦  «        dk    r|                     ||z  ¦  «         t          j        |¦  «        }||dk    |dk    z           S )z,Real roots of c0 + c1*x + c2*x**2 in [0, 1].çê-�™—q=r   é   é   g      à¿)ÚabsÚnpÚarrayÚsqrtÚappendÚasarray)Úc0Úc1Úc2ÚrootÚdiscÚ	sqrt_discÚqÚrootss           ú?C:\Projects\DSCons\.venv\Lib\site-packages\matplotlib\bezier.pyÚ_quadratic_roots_in_01r      sG  € å
ˆ2�w„w�‚€Ýˆr‰7Œ7�UŠ?ˆ?Ý”8˜B‘<”<ÐØˆs�R‰xˆØ#$¨ > >¢> >°¢> > > > >�rŒx˜˜ÑÔÐµr´xÀ±|´|ÐCà�‰7�Q˜‘V˜b‘[Ñ €DØˆa‚x€xÝŒx˜‰|Œ|Ðå”˜‘”€Ià	ˆQ‚w€wØ�B˜‘NÑ#ˆˆà�B˜‘NÑ#ˆà€EÝ
ˆ1�v„v�‚~€~Ø�Š�R˜!‘VÑÔÐÝ
ˆ2�w„w�‚€Ø�Š�Q˜‘VÑÔÐåŒJ�uÑÔ€EØ�%˜1’* ¨!¢Ñ,Ô-Ð-ó    c                 ó   — t          j        | t          ¬¦  «        } t          | ¦  «        dz
  }|dk    r=t	          | |         ¦  «        dk     r$|dz  }|dk    rt	          | |         ¦  «        dk     °$|dk    rt          j        g ¦  «        S |dk    rK| d          | d         z  }d|cxk    rdk    rn nt          j        |g¦  «        nt          j        g ¦  «        S |dk    r$t          | d         | d         | d         ¦  «        }nvd}t          j        | |dd…         ¦  «        }t          j        |j        ¦  «        |k     }||         j	        }|| k    |d|z   k    z  }t          j
        ||         dd¦  «        }t          j        |¦  «        S )	a�  
    Find real roots of a polynomial in the interval [0, 1].

    For polynomials of degree <= 2, closed-form solutions are used.
    For higher degrees, `numpy.roots` is used as a fallback. In practice,
    matplotlib only ever uses cubic bezier curves and axis_aligned_extrema()
    differentiates, so we only ever find roots for degree <= 2.

    Parameters
    ----------
    coeffs : array-like
        Polynomial coefficients in ascending order:
        ``c[0] + c[1]*x + c[2]*x**2 + ...``
        Note this is the opposite convention from `numpy.roots`.

    Returns
    -------
    roots : ndarray
        Sorted array of real roots in [0, 1].
    )Údtyper   r   r   é   g»½×Ùß|Û=Néÿÿÿÿ)r
   r   ÚfloatÚlenr	   r   r   r   ÚimagÚrealÚclipÚsort)	ÚcoeffsÚdegr   r   ÚepsÚ	all_rootsÚ	real_maskÚ
real_rootsÚin_ranges	            r   Ú_real_roots_in_01r+   +   sŠ  € õ* ŒZ˜¥eÐ,Ñ,Ô,€Fõ ˆf‰+Œ+˜‰/€CØ
�Š'ˆ'•c˜& œ+Ñ&Ô&¨Ò.Ð.Øˆq‰ˆð �Š'ˆ'•c˜& œ+Ñ&Ô&¨Ò.Ð.ð ˆa‚x€xÝŒx˜‰|Œ|ÐØ	�ŠˆØ�q”	ˆz˜F 1œIÑ%ˆØ#$¨ > >¢> >°¢> > > > >�rŒx˜˜ÑÔÐµr´xÀ±|´|ÐCØ	�ŠˆÝ& v¨a¤y°&¸´)¸VÀA¼YÑGÔGˆˆð ˆÝ”H˜V C G¨ Gœ_Ñ-Ô-ˆ	Ý”F˜9œ>Ñ*Ô*¨SÒ0ˆ	Ø˜yÔ)Ô.ˆ
Ø 3 $Ò&¨:¸¸S¹Ò+@ÑAˆÝ”˜
 8Ô,¨a°Ñ3Ô3ˆåŒ7�5‰>Œ>Ðr   é   )Úmaxsizec                 ó  — d„ }t          j        | dz   ¦  «        dd…df         }t          j        | dz   ¦  «        ddd…f         }d||z   z   |||¦  «        z  } || |¦  «        |z                       t          ¦  «        S )a&  
    Compute the matrix for converting Bezier control points to polynomial
    coefficients for a curve of degree n.

    The matrix M is such that M @ control_points gives polynomial coefficients.
    Entry M[j, i] = C(n, j) * (-1)^(i+j) * C(j, i) where C is the binomial
    coefficient.
    c                 óR   —  t          j        t          j        ¦  «        | |¦  «        S ©N)r
   Ú	vectorizeÚmathÚcomb)ÚnÚks     r   Ú_combz _get_coeff_matrix.<locals>._combd   s    € Ø&�rŒ|�DœIÑ&Ô& q¨!Ñ,Ô,Ð,r   r   Nr   )r
   ÚarangeÚastyper   )r4   r6   ÚjÚiÚ	prefactors        r   Ú_get_coeff_matrixr<   Z   s’   € ð-ð -ð -õ 	Œ	�!�a‘%ÑÔ˜˜˜˜D˜Ô!€AÝ
Œ	�!�a‘%ÑÔ˜˜q˜q˜q˜Ô!€AØ˜˜Q™‘ % %¨¨1¡+¤+Ñ-€IØˆE�!�Q‰KŒK˜)Ñ#×+Ò+­EÑ2Ô2Ð2r   c                   ó   — e Zd ZdS )ÚNonIntersectingPathExceptionN)Ú__name__Ú
__module__Ú__qualname__© r   r   r>   r>   m   s   € € € € € Ø€Dr   r>   c                 ó  ‡— || z  ||z  z
  }||z  ||z  z
  }	|| }}
|| }}|
|z  ||z  z
  Št          ‰¦  «        dk     rt          d¦  «        ‚|| }}| |
}}ˆfd„||||fD ¦   «         \  }}}}||z  ||	z  z   }||z  ||	z  z   }||fS )zŽ
    Return the intersection between the line through (*cx1*, *cy1*) at angle
    *t1* and the line through (*cx2*, *cy2*) at angle *t2*.
    r   zcGiven lines do not intersect. Please verify that the angles are not equal or differ by 180 degrees.c              3   ó"   •K  — | ]	}|‰z  V — Œ
d S r0   rB   )Ú.0r5   Úad_bcs     €r   ú	<genexpr>z#get_intersection.<locals>.<genexpr>�   s'   øè è € Ð:Ð: A�a˜%‘iÐ:Ð:Ð:Ð:Ð:Ð:r   )r	   Ú
ValueError)Úcx1Úcy1Úcos_t1Úsin_t1Úcx2Úcy2Úcos_t2Úsin_t2Ú	line1_rhsÚ	line2_rhsÚaÚbÚcÚdÚa_Úb_Úc_Úd_ÚxÚyrF   s                       @r   Úget_intersectionr]   t   sí   ø€ ð ˜‘˜v¨™|Ñ+€IØ˜‘˜v¨™|Ñ+€Ið �F�7€q€AØ�F�7€q€Aà�‰E�A˜‘E‰M€EÝ
ˆ5�z„z�EÒÐÝð Nñ Oô Oð 	Oð ��ˆ€BØˆR�ˆ€BØ:Ð:Ð:Ð:¨"¨b°"°bÐ)9Ð:Ñ:Ô:�N€BˆˆB�à
ˆY‰˜˜i™Ñ'€AØ
ˆY‰˜˜i™Ñ'€Aàˆaˆ4€Kr   c                 óz   — |dk    r| || |fS || }}| |}}||z  | z   ||z  |z   }
}	||z  | z   ||z  |z   }}|	|
||fS )z·
    For a line passing through (*cx*, *cy*) and having an angle *t*, return
    locations of the two points located along its perpendicular line at the
    distance of *length*.
    ç        rB   )ÚcxÚcyÚcos_tÚsin_tÚlengthrK   rL   rO   rP   Úx1Úy1Úx2Úy2s                r   Úget_normal_pointsri   •   su   € ð �‚|€|Ø�2�r˜2ˆ~Ðà˜U˜FˆF€FØ�V˜UˆF€Fà�f‰_˜rÑ! 6¨F¡?°RÑ#7ˆ€BØ�f‰_˜rÑ! 6¨F¡?°RÑ#7ˆ€Bàˆr�2�rˆ>Ðr   c                 óB   — | d d…         d|z
  z  | dd …         |z  z   }|S )Nr   r   rB   )ÚbetaÚtÚ	next_betas      r   Ú_de_casteljau1rn   ®   s/   € Ø�S�b�S”	˜Q ™UÑ# d¨1¨2¨2¤h°¡lÑ2€IØÐr   c                 óø   — t          j        | ¦  «        } | g}	 t          | |¦  «        } |                     | ¦  «         t	          | ¦  «        dk    rnŒ:d„ |D ¦   «         }d„ t          |¦  «        D ¦   «         }||fS )u•   
    Split a BÃ©zier segment defined by its control points *beta* into two
    separate segments divided at *t* and return their control points.
    Tr   c                 ó   — g | ]
}|d          ‘ŒS )r   rB   ©rE   rk   s     r   ú
<listcomp>z&split_de_casteljau.<locals>.<listcomp>¿   s   € Ð/Ð/Ð/˜T��a”Ð/Ð/Ð/r   c                 ó   — g | ]
}|d          ‘ŒS )r   rB   rq   s     r   rr   z&split_de_casteljau.<locals>.<listcomp>À   s   € Ð;Ð;Ð;˜t�$�r”(Ð;Ð;Ð;r   )r
   r   rn   r   r   Úreversed)rk   rl   Ú	beta_listÚ	left_betaÚ
right_betas        r   Úsplit_de_casteljaurx   ³   s”   € õ
 Œ:�dÑÔ€DØ�€IðÝ˜d AÑ&Ô&ˆØ×Ò˜ÑÔÐÝˆt‰9Œ9˜Š>ˆ>Øð	ð
 0Ð/ YÐ/Ñ/Ô/€IØ;Ð;¥x°	Ñ':Ô':Ð;Ñ;Ô;€Jà�jÐ Ð r   r_   ç      ð?ç{®Gáz„?c                 óŽ  —  | |¦  «        } | |¦  «        } ||¦  «        } ||¦  «        }||k    r||k    rt          d¦  «        ‚	 t          j        |d         |d         z
  |d         |d         z
  ¦  «        |k     r||fS d||z   z  }	 | |	¦  «        }
 ||
¦  «        }||z  r|	}||
k    r||fS |
}n|	}||
k    r||fS |
}|}Œ~)uŒ  
    Find the intersection of the BÃ©zier curve with a closed path.

    The intersection point *t* is approximated by two parameters *t0*, *t1*
    such that *t0* <= *t* <= *t1*.

    Search starts from *t0* and *t1* and uses a simple bisecting algorithm
    therefore one of the end points must be inside the path while the other
    doesn't. The search stops when the distance of the points parametrized by
    *t0* and *t1* gets smaller than the given *tolerance*.

    Parameters
    ----------
    bezier_point_at_t : callable
        A function returning x, y coordinates of the BÃ©zier at parameter *t*.
        It must have the signature::

            bezier_point_at_t(t: float) -> tuple[float, float]

    inside_closedpath : callable
        A function returning True if a given point (x, y) is inside the
        closed path. It must have the signature::

            inside_closedpath(point: tuple[float, float]) -> bool

    t0, t1 : float
        Start parameters for the search.

    tolerance : float
        Maximal allowed distance between the final points.

    Returns
    -------
    t0, t1 : float
        The BÃ©zier path parameters.
    z3Both points are on the same side of the closed pathTr   r   ç      à?)r>   r
   Úhypot)Úbezier_point_at_tÚinside_closedpathÚt0Út1Ú	toleranceÚstartÚendÚstart_insideÚ
end_insideÚmiddle_tÚmiddleÚmiddle_insides               r   Ú*find_bezier_t_intersecting_with_closedpathrŠ   Å   s5  € ðL Ð˜bÑ!Ô!€EØ
Ð
˜BÑ
Ô
€Cà$Ð$ UÑ+Ô+€LØ"Ð" 3Ñ'Ô'€Jà�zÒ!Ð! e¨s¢l lÝ*ØAñCô Cð 	Cð)õ Œ8�E˜!”H˜s 1œvÑ% u¨Q¤x°#°a´&Ñ'8Ñ9Ô9¸IÒEÐEØ�r�6ˆMð ˜"˜r™'‘?ˆØ"Ð" 8Ñ,Ô,ˆØ)Ð)¨&Ñ1Ô1ˆà˜-Ñ'ð 	)ØˆBØ�fŠ}ˆ}ð ˜2�v�ØˆCˆCàˆBØ˜Šˆð ˜2�v�ØˆEØ(ˆLð3)r   c                   ó²   — e Zd ZdZd„ Zd„ Z ej        dd¬¦  «        d„ ¦   «         Ze	d„ ¦   «         Z
e	d	„ ¦   «         Ze	d
„ ¦   «         Ze	d„ ¦   «         Zd„ ZdS )ÚBezierSegmentu*  
    A d-dimensional BÃ©zier segment.

    A BezierSegment can be called with an argument, either a scalar or an array-like
    object, to evaluate the curve at that/those location(s).

    Parameters
    ----------
    control_points : (N, d) array
        Location of the *N* control points.
    c                 ó  ‡ — t          j        |¦  «        ‰ _        ‰ j        j        \  ‰ _        ‰ _        t          j        ‰ j        ¦  «        ‰ _        ˆ fd„t          ‰ j        ¦  «        D ¦   «         }‰ j        j	        |z  j	        ‰ _
        d S )Nc                 ó²   •— g | ]S}t          j        ‰j        d z
  ¦  «        t          j        |¦  «        t          j        ‰j        d z
  |z
  ¦  «        z  z  ‘ŒTS )r   )r2   Ú	factorialÚ_N)rE   r:   Úselfs     €r   rr   z*BezierSegment.__init__.<locals>.<listcomp>"  se   ø€ ð *ð *ð *àõ ” ¤¨!¡Ñ,Ô,Ý”^ AÑ&Ô&­¬¸¼À!¹Àa¹Ñ)HÔ)HÑHñJð *ð *ð *r   )r
   r   Ú_cpointsÚshaper�   Ú_dr7   Ú_ordersÚrangeÚTÚ_px)r‘   Úcontrol_pointsÚcoeffs   `  r   Ú__init__zBezierSegment.__init__  sƒ   ø€ Ýœ
 >Ñ2Ô2ˆŒØœ=Ô.ÑˆŒ�”Ý”y ¤Ñ)Ô)ˆŒð*ð *ð *ð *å ¤™.œ.ð*ñ *ô *ˆð ”M”O eÑ+Ô.ˆŒˆˆr   c                 óè   — t          j        |¦  «        }t           j                             d|z
  | j        ddd…         ¦  «        t           j                             || j        ¦  «        z  | j        z  S )u)  
        Evaluate the BÃ©zier curve at point(s) *t* in [0, 1].

        Parameters
        ----------
        t : (k,) array-like
            Points at which to evaluate the curve.

        Returns
        -------
        (k, d) array
            Value of the curve for each point in *t*.
        r   Nr   )r
   r   ÚpowerÚouterr•   r˜   ©r‘   rl   s     r   Ú__call__zBezierSegment.__call__'  s^   € õ ŒJ�q‰MŒMˆÝ”—’˜q 1™u d¤l°4°4°R°4Ô&8Ñ9Ô9Ý”(—.’.  D¤LÑ1Ô1ñ2Ø59´Xñ>ð 	>r   z3.11z/Call the BezierSegment object with an argument.)Úalternativec                 ó2   — t           | |¦  «        ¦  «        S )zX
        Evaluate the curve at a single point, returning a tuple of *d* floats.
        ©ÚtuplerŸ   s     r   Ú
point_at_tzBezierSegment.point_at_t9  s   € õ �T�T˜!‘W”W‰~Œ~Ðr   c                 ó   — | j         S )z The control points of the curve.)r’   ©r‘   s    r   r™   zBezierSegment.control_pointsA  s   € ð Œ}Ðr   c                 ó   — | j         S )zThe dimension of the curve.)r”   r§   s    r   Ú	dimensionzBezierSegment.dimensionF  s   € ð Œwˆr   c                 ó   — | j         dz
  S )z@Degree of the polynomial. One less the number of control points.r   )r�   r§   s    r   ÚdegreezBezierSegment.degreeK  s   € ð Œw˜‰{Ðr   c                 ó~   — | j         }|dk    rt          j        dt          ¦  «         t	          |¦  «        | j        z  S )uº  
        The polynomial coefficients of the BÃ©zier curve.

        .. warning:: Follows opposite convention from `numpy.polyval`.

        Returns
        -------
        (n+1, d) array
            Coefficients after expanding in polynomial basis, where :math:`n`
            is the degree of the BÃ©zier curve and :math:`d` its dimension.
            These are the numbers (:math:`C_j`) such that the curve can be
            written :math:`\sum_{j=0}^n C_j t^j`.

        Notes
        -----
        The coefficients are calculated as

        .. math::

            {n \choose j} \sum_{i=0}^j (-1)^{i+j} {j \choose i} P_i

        where :math:`P_i` are the control points of the curve.
        é
   zFPolynomial coefficients formula unstable for high order Bezier curves!)r«   ÚwarningsÚwarnÚRuntimeWarningr<   r™   )r‘   r4   s     r   Úpolynomial_coefficientsz%BezierSegment.polynomial_coefficientsP  sI   € ð2 ŒKˆàˆrŠ6ˆ6ÝŒMð 1Ý2@ñBô Bð Bå  Ñ#Ô# dÔ&9Ñ9Ð9r   c                 óŒ  — | j         }|dk    r(t          j        g ¦  «        t          j        g ¦  «        fS | j        }t          j        d|dz   ¦  «        dd…df         |dd…         z  }g }g }t          |j        ¦  «        D ]q\  }}t          |¦  «        }t          |¦  «        dk    rJ| 	                    |¦  «         | 	                    t          j
        t          |¦  «        |¦  «        ¦  «         Œr|s(t          j        g ¦  «        t          j        g ¦  «        fS t          j        |¦  «        t          j        |¦  «        fS )aã  
        Return the dimension and location of the curve's interior extrema.

        The extrema are the points along the curve where one of its partial
        derivatives is zero.

        Returns
        -------
        dims : array of int
            Index :math:`i` of the partial derivative which is zero at each
            interior extrema.
        dzeros : array of float
            Of same size as dims. The :math:`t` such that :math:`d/dx_i B(t) =
            0`
        r   Nr   )r«   r
   r   r±   r7   Ú	enumerater—   r+   r   r   ÚfullÚconcatenate)	r‘   r4   ÚCjÚdCjÚall_dimsr'   r:   ÚpiÚrs	            r   Úaxis_aligned_extremaz"BezierSegment.axis_aligned_extremap  s$  € ð  ŒKˆØ�Š6ˆ6Ý”8˜B‘<”<¥¤¨"¡¤Ð-Ð-ØÔ)ˆÝŒi˜˜1˜q™5Ñ!Ô! ! ! ! T 'Ô*¨R°°°¬VÑ3ˆàˆØˆ	å˜sœuÑ%Ô%ð 	4ð 	4‰EˆAˆrÝ! "Ñ%Ô%ˆAÝ�1‰vŒv˜ŠzˆzØ× Ò  Ñ#Ô#Ð#Ø—’¥¤­¨A©¬°Ñ 2Ô 2Ñ3Ô3Ð3øàð 	.Ý”8˜B‘<”<¥¤¨"¡¤Ð-Ð-åŒ~˜hÑ'Ô'­¬¸	Ñ)BÔ)BÐBÐBr   N)r?   r@   rA   Ú__doc__r›   r    r   Ú
deprecatedr¥   Úpropertyr™   r©   r«   r±   r»   rB   r   r   rŒ   rŒ     sø   € € € € € ð
ð 
ð/ð /ð /ð>ð >ð >ð$ €T„_ØÐMðOñ Oô Oðð ñOô Oðð ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ð:ð :ñ „Xð:ð>"Cð "Cð "Cð "Cð "Cr   rŒ   c                 óŒ   ‡— t          | ¦  «        Št          ˆfd„||¬¦  «        \  }}t          | ||z   dz  ¦  «        \  }}||fS )ur  
    Split a BÃ©zier curve into two at the intersection with a closed path.

    Parameters
    ----------
    bezier : (N, 2) array-like
        Control points of the BÃ©zier segment. See `.BezierSegment`.
    inside_closedpath : callable
        A function returning True if a given point (x, y) is inside the
        closed path. See also `.find_bezier_t_intersecting_with_closedpath`.
    tolerance : float
        The tolerance for the intersection. See also
        `.find_bezier_t_intersecting_with_closedpath`.

    Returns
    -------
    left, right
        Lists of control points for the two BÃ©zier segments.
    c                 ó4   •— t           ‰| ¦  «        ¦  «        S r0   r£   )rl   Úbzs    €r   ú<lambda>z;split_bezier_intersecting_with_closedpath.<locals>.<lambda>®  s   ø€ •%˜˜˜1™œ‘,”,€ r   )r‚   g       @)rŒ   rŠ   rx   )Úbezierr   r‚   r€   r�   Ú_leftÚ_rightrÁ   s          @r   Ú)split_bezier_intersecting_with_closedpathrÆ   •  se   ø€ õ, 
�vÑ	Ô	€Bå7ØÐÐÐÐ 1¸YðHñ Hô H�F€Bˆõ ' v°°R±¸2©~Ñ>Ô>�M€Eˆ6Ø�&ˆ=Ðr   Fc           	      óF  — ddl m} |                      ¦   «         }t          |¦  «        \  }} ||dd…         ¦  «        }|}	d}
d}|D ]U\  }}|}
|t	          |¦  «        dz  z  } ||dd…         ¦  «        |k    r t          j        |	dd…         |g¦  «        } n|}	ŒVt          d¦  «        ‚|                     d¦  «        }t          |||¦  «        \  }}t	          |¦  «        dk    r|j
        g}|j        |j
        g}n‡t	          |¦  «        d	k    r#|j        |j        g}|j        |j        |j        g}nQt	          |¦  «        d
k    r/|j        |j        |j        g}|j        |j        |j        |j        g}nt          d¦  «        ‚|dd…         }|dd…         }| j        €Y |t          j        | j        d|…         |g¦  «        ¦  «        } |t          j        || j        |d…         g¦  «        ¦  «        }nœ |t          j        | j        d|
…         |g¦  «        t          j        | j        d|
…         |g¦  «        ¦  «        } |t          j        || j        |d…         g¦  «        t          j        || j        |d…         g¦  «        ¦  «        }|r|s||}}||fS )z`
    Divide a path into two segments at the point where ``inside(x, y)`` becomes
    False.
    r   )ÚPathéþÿÿÿNr   r   z*The path does not intersect with the patch)r   r   é   r   zThis should never be reached)ÚpathrÈ   Úiter_segmentsÚnextr   r
   rµ   rH   ÚreshaperÆ   ÚLINETOÚMOVETOÚCURVE3ÚCURVE4ÚAssertionErrorÚcodesÚvertices)rË   Úinsider‚   Úreorder_inoutrÈ   Ú	path_iterÚ
ctl_pointsÚcommandÚbegin_insideÚctl_points_oldÚioldr:   Úbezier_pathÚbpÚleftÚrightÚ
codes_leftÚcodes_rightÚ
verts_leftÚverts_rightÚpath_inÚpath_outs                         r   Úsplit_path_inoutrè   ·  sæ  € ð
 ÐÐÐÐÐØ×"Ò"Ñ$Ô$€Iå˜y™/œ/Ñ€J�Ø�6˜* R S Sœ/Ñ*Ô*€Là€Nà€DØ	€Aà(ð Gð GÑˆ
�GØˆØ	�S�‰_Œ_ Ñ!Ñ!ˆØˆ6�*˜R˜S˜S”/Ñ"Ô" lÒ2Ð2Ýœ.¨.¸¸¸Ô*=¸zÐ)JÑKÔKˆKØˆEØ#ˆˆåÐEÑFÔFÐFà	×	Ò	˜WÑ	%Ô	%€BÝ;Ø
ˆF�Iñô �K€Dˆ%å
ˆ4�y„y�A‚~€~Ø”k�]ˆ
Ø”{ D¤KÐ0ˆˆÝ	ˆT‰Œ�aŠˆØ”k 4¤;Ð/ˆ
Ø”{ D¤K°´Ð=ˆˆÝ	ˆT‰Œ�aŠˆØ”k 4¤;°´Ð<ˆ
Ø”{ D¤K°´¸d¼kÐJˆˆåÐ;Ñ<Ô<Ð<à�a�b�b”€JØ˜˜˜”(€Kà„zÐØ�$•r”~ t¤}°R°a°RÔ'8¸*Ð&EÑFÔFÑGÔGˆØ�4�œ¨°T´]À1À2À2Ô5FÐ'GÑHÔHÑIÔIˆˆð �$•r”~ t¤}°U°d°UÔ';¸ZÐ&HÑIÔIÝ”~ t¤z°%°4°%Ô'8¸*Ð&EÑFÔFñHô Hˆð �4�œ¨°T´]À1À2À2Ô5FÐ'GÑHÔHÝœ¨°T´ZÀÀÀ´^Ð'DÑEÔEñGô Gˆð ð .˜\ð .Ø$ g�ˆà�HÐÐr   c                 ó$   ‡ ‡‡— |dz  Šˆ ˆˆfd„}|S )zÎ
    Return a function that checks whether a point is in a circle with center
    (*cx*, *cy*) and radius *r*.

    The returned function has the signature::

        f(xy: tuple[float, float]) -> bool
    r   c                 ó8   •— | \  }}|‰z
  dz  |‰z
  dz  z   ‰k     S )Nr   rB   )Úxyr[   r\   r`   ra   Úr2s      €€€r   Ú_fzinside_circle.<locals>._fÿ  s,   ø€ Ø‰ˆˆ1Ø�B‘˜1‰}  B¡¨1™}Ñ,¨rÒ1Ð1r   rB   )r`   ra   rº   rí   rì   s   ``  @r   Úinside_circlerî   ô  s:   øøø€ ð 
ˆa‰€Bð2ð 2ð 2ð 2ð 2ð 2ð 2ð €Ir   c                 óV   — || z
  ||z
  }}||z  ||z  z   dz  }|dk    rdS ||z  ||z  fS )Nr|   r   )r_   r_   rB   )Úx0Úy0re   rf   ÚdxÚdyrV   s          r   Úget_cos_sinrô     sJ   € Ø�"‰W�b˜2‘gˆ€BØ	ˆb‰�2˜‘7Ñ	˜rÑ!€AàˆA‚v€vØˆxØ�‰6�2˜‘6ˆ>Ðr   çñhãˆµøä>c                 óÒ   — t          j        | |¦  «        }t          j        ||¦  «        }t          ||z
  ¦  «        }||k     rdS t          |t           j        z
  ¦  «        |k     rdS dS )aË  
    Check if two lines are parallel.

    Parameters
    ----------
    dx1, dy1, dx2, dy2 : float
        The gradients *dy*/*dx* of the two lines.
    tolerance : float
        The angular tolerance in radians up to which the lines are considered
        parallel.

    Returns
    -------
    is_parallel
        - 1 if two lines are parallel in same direction.
        - -1 if two lines are parallel in opposite direction.
        - False otherwise.
    r   r   F)r
   Úarctan2r	   r¹   )Údx1Údy1Údx2Údy2r‚   Útheta1Útheta2Údthetas           r   Úcheck_if_parallelrÿ     sj   € õ& ŒZ˜˜SÑ!Ô!€FÝŒZ˜˜SÑ!Ô!€FÝ�˜&‘Ñ!Ô!€FØ�	ÒÐØˆqÝ	ˆV•b”e‰^Ñ	Ô	˜yÒ	(Ð	(Øˆràˆur   c           
      ó˜  — | d         \  }}| d         \  }}| d         \  }}t          ||z
  ||z
  ||z
  ||z
  ¦  «        }|dk    r.t          j        d¦  «         t          ||||¦  «        \  }	}
|	|
}}n*t          ||||¦  «        \  }	}
t          ||||¦  «        \  }}t	          |||	|
|¦  «        \  }}}}t	          |||||¦  «        \  }}}}	 t          |||	|
||||¦  «        \  }}t          |||	|
||||¦  «        \  }}n0# t          $ r# d||z   z  d||z   z  }}d||z   z  d||z   z  }}Y nw xY w||f||f||fg}||f||f||fg}||fS )u­   
    Given the quadratic BÃ©zier control points *bezier2*, returns
    control points of quadratic BÃ©zier lines roughly parallel to given
    one separated by *width*.
    r   r   r   r   z8Lines do not intersect. A straight line is used instead.r|   )rÿ   r   Úwarn_externalrô   ri   r]   rH   )Úbezier2ÚwidthÚc1xÚc1yÚcmxÚcmyÚc2xÚc2yÚparallel_testrK   rL   rO   rP   Úc1x_leftÚc1y_leftÚ	c1x_rightÚ	c1y_rightÚc2x_leftÚc2y_leftÚ	c2x_rightÚ	c2y_rightÚcmx_leftÚcmy_leftÚ	cmx_rightÚ	cmy_rightÚ	path_leftÚ
path_rights                              r   Úget_parallelsr  .  s  € ð �qŒz�H€CˆØ�qŒz�H€CˆØ�qŒz�H€Cˆå% c¨C¡i°°s±Ø&)¨C¡i°°s±ñ<ô <€Mð ˜ÒÐÝÔØFñ	Hô 	Hð 	Hå$ S¨#¨s°CÑ8Ô8‰ˆ�Ø �ˆˆõ % S¨#¨s°CÑ8Ô8‰ˆ�Ý$ S¨#¨s°CÑ8Ô8‰ˆ�õ 	˜#˜s F¨F°EÑ:Ô:ñ -€Hˆh˜	 9õ 	˜#˜s F¨F°EÑ:Ô:ñ -€Hˆh˜	 9ð
Ý-¨h¸À&Ø.4°hÀØ.4°fñ>ô >Ñˆ�(õ  0°	¸9ÀfØ06¸	À9Ø06¸ñ @ô  @Ñˆ	�9�9øõ ð 	
ð 	
ð 	
ð
 �8˜hÑ&Ñ'¨°¸8Ñ0CÑ)Dð ˆð �9˜yÑ(Ñ)¨3°)¸iÑ2GÑ+Hð ˆ	ˆ	ˆ	ð	
øøøð ˜HÐ%Ø˜HÐ%Ø˜HÐ%ð'€Ið ˜iÐ(Ø˜iÐ(Ø˜iÐ(ð*€Jð �jÐ Ð s   Ã2D Ä*D/Ä.D/c                 óP   — dd|z  | |z   z
  z  }dd|z  ||z   z
  z  }| |f||f||fgS )už   
    Find control points of the BÃ©zier curve passing through (*c1x*, *c1y*),
    (*mmx*, *mmy*), and (*c2x*, *c2y*), at parametric values 0, 0.5, and 1.
    r|   r   rB   )r  r  ÚmmxÚmmyr  r	  r  r  s           r   Úfind_control_pointsr  x  sK   € ð
 ��C‘˜3 ™9Ñ%Ñ
&€CØ
��C‘˜3 ™9Ñ%Ñ
&€CØ�#ˆJ˜˜c˜
 S¨# JÐ/Ð/r   r|   c                 ó  — | d         \  }}| d         \  }}| d         \  }	}
t          ||||¦  «        \  }}t          |||	|
¦  «        \  }}t          ||||||z  ¦  «        \  }}}}t          |	|
||||z  ¦  «        \  }}}}||z   dz  ||z   dz  }}||	z   dz  ||
z   dz  }}||z   dz  ||z   dz  }}t          ||||¦  «        \  }}t          ||||||z  ¦  «        \  }} }!}"t          |||| ||¦  «        }#t          |||!|"||¦  «        }$|#|$fS )u¬   
    Being similar to `get_parallels`, returns control points of two quadratic
    BÃ©zier lines having a width roughly parallel to given one separated by
    *width*.
    r   r   r   r|   )rô   ri   r  )%r  r  Úw1ÚwmÚw2r  r  r  r  Úc3xÚc3yrK   rL   rO   rP   r  r  r  r  Úc3x_leftÚc3y_leftÚ	c3x_rightÚ	c3y_rightÚc12xÚc12yÚc23xÚc23yÚc123xÚc123yÚcos_t123Úsin_t123Ú
c123x_leftÚ
c123y_leftÚc123x_rightÚc123y_rightr  r  s%                                        r   Úmake_wedged_bezier2r4  ‚  s…  € ð �qŒz�H€CˆØ�qŒz�H€CˆØ�qŒz�H€Cˆõ !  c¨3°Ñ4Ô4�N€FˆFÝ   c¨3°Ñ4Ô4�N€FˆFõ 	˜#˜s F¨F°E¸B±JÑ?Ô?ñ -€Hˆh˜	 9õ 	˜#˜s F¨F°E¸B±JÑ?Ô?ñ -€Hˆh˜	 9ð ˜‘)˜rÑ! C¨#¡I°Ñ#3ˆ$€DØ˜‘)˜rÑ! C¨#¡I°Ñ#3ˆ$€DØ˜4‘K 2Ñ%¨¨t©°rÑ'9ˆ5€Eõ % T¨4°°tÑ<Ô<Ñ€Hˆhõ 	˜% ¨°(¸EÀB¹JÑGÔGñ 5€J�
˜K¨õ $ H¨hØ$.°
Ø$,¨hñ8ô 8€Iõ % Y°	Ø%0°+Ø%.°	ñ;ô ;€Jð �jÐ Ð r   )r_   ry   rz   )rz   )rz   F)rõ   )ry   r|   r_   )r¼   Ú	functoolsr   r2   r®   Únumpyr
   Ú
matplotlibr   r   r+   r<   rH   r>   r]   ri   rn   rx   rŠ   rŒ   rÆ   rè   rî   rô   rÿ   r  r  r4  rB   r   r   ú<module>r8     sü  ððð ð  Ð Ð Ð Ð Ð Ø €€€Ø €€€à Ð Ð Ð à Ð Ð Ð Ð Ð ð.ð .ð .ð:,ð ,ð ,ð^ €�2ÐÑÔð3ð 3ñ Ôð3ð$	ð 	ð 	ð 	ð 	 :ñ 	ô 	ð 	ðð ð ðBð ð ð2ð ð ð
!ð !ð !ð& GKðI)ð I)ð I)ð I)ðXACð ACð ACð ACð ACñ ACô ACð ACðJ .2ðð ð ð ðD:ð :ð :ð :ðzð ð ð&ð ð ðð ð ð ð<G!ð G!ð G!ðT0ð 0ð 0ð0!ð 0!ð 0!ð 0!ð 0!ð 0!r   