intellecton/venv/lib/python3.12/site-packages/matplotlib/__pycache__/bezier.cpython-312.pyc

277 lines
21 KiB
Text
Raw Normal View History

<EFBFBD>
<00>RjiJ<00><00><><00>dZddlmZddlZddlZddlZddlmZejed<05><06>d<07><00><00>Z
Gd<08>d e <0B>Z d
<EFBFBD>Z d <0B>Zd <0C>Zd <0A>Z dd<0E>ZGd<0F>d<10>Z dd<11>Zdd<12>Zd<13>Zd<14>Zdd<15>Zd<16>Zd<17>Zdd<18>Zy)uP
A module providing some utility functions regarding Bézier path manipulation.
<EFBFBD>)<01> lru_cacheN)<01>_api<70><69>)<01>maxsizec<00><><00>||kDryt|||z
<00>}tjd|dz<00>}tj|dz|z
|z <00>j t
<00>S)Nr<00>)<06>min<69>np<6E>arange<67>prod<6F>astype<70>int)<03>n<>k<>is <20>T/home/antigravity/intellecton/venv/lib/python3.12/site-packages/matplotlib/bezier.py<70>_combrsW<00><00> <09>1<EFBFBD>u<EFBFBD><10> <0B>A<EFBFBD>q<EFBFBD>1<EFBFBD>u<EFBFBD> <0A>A<EFBFBD>
<EFBFBD> <09> <09>!<21>Q<EFBFBD><11>U<EFBFBD><1B>A<EFBFBD> <0A>7<EFBFBD>7<EFBFBD>A<EFBFBD><01>E<EFBFBD>A<EFBFBD>I<EFBFBD>q<EFBFBD>=<3D> !<21> (<28> (<28><13> -<2D>-<2D>c<00> <00>eZdZy)<02>NonIntersectingPathExceptionN)<03>__name__<5F>
__module__<EFBFBD> __qualname__<5F>rrrrs<00><00>rrc<00><><00><14>||z||zz
}||z||zz
} || } }
|| } } |
| z| | zz
<00>t<00><14>dkr td<02><00>| | }}| |
}}<10>fd<03>||||fD<00>\}}}}||z|| zz}||z|| zz}||fS)z<>
Return the intersection between the line through (*cx1*, *cy1*) at angle
*t1* and the line through (*cx2*, *cy2*) at angle *t2*.
g<11>-<2D><><EFBFBD>q=zcGiven lines do not intersect. Please verify that the angles are not equal or differ by 180 degrees.c3<00>(<00>K<00>|] }|<01>z <00><01><00> y<00>w)Nr)<03>.0r<00>ad_bcs <20>r<00> <genexpr>z#get_intersection.<locals>.<genexpr>9s<00><><00><><00>:<3A>A<EFBFBD>a<EFBFBD>%<25>i<EFBFBD>:<3A>s<00>)<02>abs<62>
ValueError)<15>cx1<78>cy1<79>cos_t1<74>sin_t1<74>cx2<78>cy2<79>cos_t2<74>sin_t2<74> line1_rhs<68> line2_rhs<68>a<>b<>c<>d<>a_<61>b_<62>c_<63>d_<64>x<>yrs @r<00>get_intersectionr6 s<><00><><00><17><13> <0C>v<EFBFBD><03>|<7C>+<2B>I<EFBFBD><16><13> <0C>v<EFBFBD><03>|<7C>+<2B>I<EFBFBD> <12>F<EFBFBD>7<EFBFBD>q<EFBFBD>A<EFBFBD> <11>F<EFBFBD>7<EFBFBD>q<EFBFBD>A<EFBFBD> <0A><01>E<EFBFBD>A<EFBFBD><01>E<EFBFBD>M<EFBFBD>E<EFBFBD>
<EFBFBD>5<EFBFBD>z<EFBFBD>E<EFBFBD><19><18>N<01>O<01> O<01><0F><11><02><02>B<EFBFBD><0F>R<EFBFBD><11><02>B<EFBFBD>:<3A>"<22>b<EFBFBD>"<22>b<EFBFBD>)9<>:<3A>N<EFBFBD>B<EFBFBD><02>B<EFBFBD><02>
<EFBFBD>Y<EFBFBD><0E><12>i<EFBFBD><1E>'<27>A<EFBFBD>
<EFBFBD>Y<EFBFBD><0E><12>i<EFBFBD><1E>'<27>A<EFBFBD> <0C>a<EFBFBD>4<EFBFBD>Krc<00>x<00>|dk(r||||fS|| }}| |}}||z|z||z|z}
} ||z|z||z|z} } | |
| | fS)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*.
<20>r) <0A>cx<63>cy<63>cos_t<5F>sin_t<5F>lengthr$r%r(r)<00>x1<78>y1<79>x2<78>y2s r<00>get_normal_pointsrBAss<00><00><0E><12>|<7C><11>2<EFBFBD>r<EFBFBD>2<EFBFBD>~<7E><1D><1A>U<EFBFBD>F<EFBFBD>F<EFBFBD>F<EFBFBD><1B>V<EFBFBD>U<EFBFBD>F<EFBFBD>F<EFBFBD> <13>f<EFBFBD>_<EFBFBD>r<EFBFBD> !<21>6<EFBFBD>F<EFBFBD>?<3F>R<EFBFBD>#7<><02>B<EFBFBD> <13>f<EFBFBD>_<EFBFBD>r<EFBFBD> !<21>6<EFBFBD>F<EFBFBD>?<3F>R<EFBFBD>#7<><02>B<EFBFBD> <0A>r<EFBFBD>2<EFBFBD>r<EFBFBD>><3E>rc<00>.<00>|ddd|z
z|dd|zz}|S)N<><4E><EFBFBD><EFBFBD><EFBFBD>rr)<03>beta<74>t<> next_betas r<00>_de_casteljau1rHZs+<00><00><14>S<EFBFBD>b<EFBFBD> <09>Q<EFBFBD><11>U<EFBFBD>#<23>d<EFBFBD>1<EFBFBD>2<EFBFBD>h<EFBFBD><11>l<EFBFBD>2<>I<EFBFBD> <14>rc<00><00>tj|<00>}|g} t||<01>}|j|<00>t |<00>dk(rn<01>-|D<00>cgc]}|d<00><02> }}t |<02>D<00>cgc]}|d<00><02> }}||fScc}wcc}w)u<>
Split a Bézier segment defined by its control points *beta* into two
separate segments divided at *t* and return their control points.
rrrD)r
<00>asarrayrH<00>append<6E>len<65>reversed)rErF<00> beta_list<73> left_beta<74>
right_betas r<00>split_de_casteljaurQ_s<><00><00>
<0E>:<3A>:<3A>d<EFBFBD> <1B>D<EFBFBD><15><06>I<EFBFBD>
<0E><1D>d<EFBFBD>A<EFBFBD>&<26><04><11><18><18><14><1E> <0E>t<EFBFBD>9<EFBFBD><01>><3E> <11> <0F>
&/<2F>/<2F>T<EFBFBD><14>a<EFBFBD><17>/<2F>I<EFBFBD>/<2F>'/<2F> <09>':<3A>;<3B>t<EFBFBD>$<24>r<EFBFBD>(<28>;<3B>J<EFBFBD>;<3B> <14>j<EFBFBD> <20> <20><>0<><30>;s <00> A8<04>& A=c<00>B<00>||<02>}||<03>}||<05>}||<06>}||k(r||k7r td<01><00> tj|d|dz
|d|dz
<00>|kr||fSd||zz} || <09>}
||
<EFBFBD>} || z r| }||
k(r||fS|
}n| }||
k(r||fS|
}| }<07>j)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 pathrr<00><00>?)rr
<00>hypot) <0C>bezier_point_at_t<5F>inside_closedpath<74>t0<74>t1<74> tolerance<63>start<72>end<6E> start_inside<64>
end_inside<EFBFBD>middle_t<5F>middle<6C> middle_insides r<00>*find_bezier_t_intersecting_with_closedpathraqs<><00><00>L <1E>b<EFBFBD> !<21>E<EFBFBD>
<1B>B<EFBFBD>
<1F>C<EFBFBD>$<24>U<EFBFBD>+<2B>L<EFBFBD>"<22>3<EFBFBD>'<27>J<EFBFBD><13>z<EFBFBD>!<21>e<EFBFBD>s<EFBFBD>l<EFBFBD>*<2A> A<>C<01> C<01> <0F> <0E>8<EFBFBD>8<EFBFBD>E<EFBFBD>!<21>H<EFBFBD>s<EFBFBD>1<EFBFBD>v<EFBFBD>%<25>u<EFBFBD>Q<EFBFBD>x<EFBFBD>#<23>a<EFBFBD>&<26>'8<> 9<>I<EFBFBD> E<><15>r<EFBFBD>6<EFBFBD>M<EFBFBD><17>"<22>r<EFBFBD>'<27>?<3F><08>"<22>8<EFBFBD>,<2C><06>)<29>&<26>1<> <0A> <17>-<2D> '<27><19>B<EFBFBD><12>f<EFBFBD>}<7D><1A>2<EFBFBD>v<EFBFBD> <0A><18>C<EFBFBD><19>B<EFBFBD><14><06><EFBFBD><1A>2<EFBFBD>v<EFBFBD> <0A><1A>E<EFBFBD>(<28>L<EFBFBD>3 rc<00>h<00>eZdZdZd<02>Zd<03>Zd<04>Zed<05><00>Zed<06><00>Z ed<07><00>Z
ed<08><00>Z d <09>Z y
) <0B> BezierSegmentu<74>
A d-dimensional Bézier segment.
Parameters
----------
control_points : (N, d) array
Location of the *N* control points.
c <00><00>tj|<01>|_|jj\|_|_tj |j<00>|_t|j<00>D<00>cgc]`}tj|jdz
<00>tj|<02>tj|jdz
|z
<00>zz<00><02>b}}|jj|zj|_ ycc}w)Nr) r
rJ<00>_cpoints<74>shape<70>_N<5F>_dr <00>_orders<72>range<67>math<74> factorial<61>T<>_px)<04>self<6C>control_pointsr<00>coeffs r<00>__init__zBezierSegment.__init__<5F>s<><00><00><1A>
<EFBFBD>
<EFBFBD>><3E>2<><04> <0A><1F>=<3D>=<3D>.<2E>.<2E><18><04><07><14><17><19>y<EFBFBD>y<EFBFBD><14><17><17>)<29><04> <0C> <20><04><07><07>.<2E>*<2A><16><16><1E><1E><04><07><07>!<21> <0B>,<2C><19>^<5E>^<5E>A<EFBFBD>&<26><14><1E><1E><04><07><07>!<21> <0B>a<EFBFBD><0F>)H<>H<>J<01>*<2A><05>*<2A><19>M<EFBFBD>M<EFBFBD>O<EFBFBD>O<EFBFBD>e<EFBFBD>+<2B>.<2E>.<2E><04><08><>*s<00>9A%D c<00><00>tj|<01>}tjjd|z
|jddd<03><00>tjj||j<00>z|j
zS)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*.
rNrD)r
rJ<00>power<65>outerrirn<00>rorFs r<00>__call__zBezierSegment.__call__<5F>s`<00><00> <0F>J<EFBFBD>J<EFBFBD>q<EFBFBD>M<EFBFBD><01><12><08><08><0E><0E>q<EFBFBD>1<EFBFBD>u<EFBFBD>d<EFBFBD>l<EFBFBD>l<EFBFBD>4<EFBFBD>R<EFBFBD>4<EFBFBD>&8<>9<><14>(<28>(<28>.<2E>.<2E><11>D<EFBFBD>L<EFBFBD>L<EFBFBD>1<>2<>59<35>X<EFBFBD>X<EFBFBD>><3E> >rc<00>$<00>t||<01><00>S)zX
Evaluate the curve at a single point, returning a tuple of *d* floats.
)<01>tuplervs r<00>
point_at_tzBezierSegment.point_at_t<5F>s<00><00><15>T<EFBFBD>!<21>W<EFBFBD>~<7E>rc<00><00>|jS)z The control points of the curve.)re<00>ros rrpzBezierSegment.control_points<74>s<00><00><14>}<7D>}<7D>rc<00><00>|jS)zThe dimension of the curve.)rhr|s r<00> dimensionzBezierSegment.dimension<6F>s <00><00><14>w<EFBFBD>w<EFBFBD>rc<00> <00>|jdz
S)z@Degree of the polynomial. One less the number of control points.r)rgr|s r<00>degreezBezierSegment.degree<65>s<00><00><14>w<EFBFBD>w<EFBFBD><11>{<7B>rc<00>:<00>|j}|dkDrtjdt<00>|j}t j |dz<00>dd<04>df}t j |dz<00>ddd<04>f}d||zzt||<04>z}t||<03>|z|zS)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.
<20>
zFPolynomial coefficients formula unstable for high order Bezier curves!rNrD)r<><00>warnings<67>warn<72>RuntimeWarningrpr
r r)ror<00>P<>jr<00> prefactors r<00>polynomial_coefficientsz%BezierSegment.polynomial_coefficients<74>s<><00><00>2 <11>K<EFBFBD>K<EFBFBD><01> <0C>r<EFBFBD>6<EFBFBD> <14>M<EFBFBD>M<EFBFBD>1<>2@<40> B<01> <10> <1F> <1F><01> <0E>I<EFBFBD>I<EFBFBD>a<EFBFBD><01>c<EFBFBD>N<EFBFBD>1<EFBFBD>d<EFBFBD>7<EFBFBD> #<23><01> <0E>I<EFBFBD>I<EFBFBD>a<EFBFBD><01>c<EFBFBD>N<EFBFBD>4<EFBFBD><11>7<EFBFBD> #<23><01><17>1<EFBFBD>q<EFBFBD>5<EFBFBD>M<EFBFBD>E<EFBFBD>!<21>Q<EFBFBD>K<EFBFBD>/<2F> <09><14>Q<EFBFBD><01>{<7B>Y<EFBFBD>&<26><11>*<2A>*rc<00><><00>|j}|dkr*tjg<00>tjg<00>fS|j}tjd|dz<00>dd<02>df|ddz}g}g}t |j <00>D]V\}}tj|ddd<03><00>}|j|<08>|jtj||<06><00><00>Xtj|<05>}tj|<04>}tj|<05>|dk\z|dkz} || tj|<05>| fS)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`
rNrDr) r<>r
<00>arrayr<79>r <00> enumeraterm<00>rootsrK<00> full_like<6B> concatenate<74>isreal<61>real)
ror<00>Cj<43>dCj<43>dimsr<73>r<00>pi<70>r<>in_ranges
r<00>axis_aligned_extremaz"BezierSegment.axis_aligned_extremas<00><00> <11>K<EFBFBD>K<EFBFBD><01> <0C><01>6<EFBFBD><15>8<EFBFBD>8<EFBFBD>B<EFBFBD><<3C><12><18><18>"<22><1C>-<2D> -<2D> <11> )<29> )<29><02><10>i<EFBFBD>i<EFBFBD><01>1<EFBFBD>Q<EFBFBD>3<EFBFBD><1F><01>4<EFBFBD><07>(<28>2<EFBFBD>a<EFBFBD>b<EFBFBD>6<EFBFBD>1<><03><11><04><12><05><1E>s<EFBFBD>u<EFBFBD>u<EFBFBD>%<25> ,<2C>E<EFBFBD>A<EFBFBD>r<EFBFBD><12><08><08><12>D<EFBFBD>b<EFBFBD>D<EFBFBD><18>"<22>A<EFBFBD> <11>L<EFBFBD>L<EFBFBD><11>O<EFBFBD> <10>K<EFBFBD>K<EFBFBD><02> <0C> <0C>Q<EFBFBD><01>*<2A> +<2B> ,<2C><13><0E><0E>u<EFBFBD>%<25><05><11>~<7E>~<7E>d<EFBFBD>#<23><04><15>9<EFBFBD>9<EFBFBD>U<EFBFBD>#<23>u<EFBFBD><01>z<EFBFBD>2<>e<EFBFBD>q<EFBFBD>j<EFBFBD>A<><08><13>H<EFBFBD>~<7E>r<EFBFBD>w<EFBFBD>w<EFBFBD>u<EFBFBD>~<7E>h<EFBFBD>7<>7<>7rN) rrr<00>__doc__rrrwrz<00>propertyrpr~r<>r<>r<>rrrrcrc<00>sl<00><00><08>/<2F>><3E>$<1E> <0E><1D><0E><1D><0E><17><0E><17><0E><1B><0E><1B><0E>!+<2B><0E>!+<2B>F8rrcc<00><><00>t|<00>}|j}t|||<02><01>\}}t|||zdz <00>\}}||fS)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.
)rYg@)rcrzrarQ) <09>bezierrVrY<00>bzrUrWrX<00>_left<66>_rights r<00>)split_bezier_intersecting_with_closedpathr<68><sS<00><00>,
<17>v<EFBFBD> <1E>B<EFBFBD><1A> <0A> <0A><15> 7<><19>,<2C> <09>C<01>F<EFBFBD>B<EFBFBD><02>'<27>v<EFBFBD><02>R<EFBFBD><07>2<EFBFBD>~<7E>><3E>M<EFBFBD>E<EFBFBD>6<EFBFBD> <10>&<26>=<3D>rc <00>J<00>ddlm}|j<00>}t|<05>\}}||dd<00>}|} d}
d} |D]D\}}| }
| t |<06>dzz } ||dd<00>|k7rt j | dd|g<02>} n|} <09>Ftd<07><00>| jd<08>} t| ||<02>\}}t |<0E>dk(r&|jg}|j|jg}n<>t |<0E>d k(r<|j|jg}|j|j|jg}nkt |<0E>d
k(rR|j|j|jg}|j|j|j|jg}n td <0B><00>|dd}|dd}|j<00>U|t j |j d| |g<02><00>}|t j ||j | dg<02><00>}n<>|t j |j d|
|g<02>t j |jd|
|g<02><00>}|t j ||j | dg<02>t j ||j| dg<02><00>}|r|s||}}||fS) z`
Divide a path into two segments at the point where ``inside(x, y)`` becomes
False.
r)<01>Path<74><68><EFBFBD><EFBFBD><EFBFBD>Nr<00>z*The path does not intersect with the patch)rDr<><00><00>zThis should never be reached)<11>pathr<68><00> iter_segments<74>nextrLr
r<>r!<00>reshaper<65><00>LINETO<54>MOVETO<54>CURVE3<45>CURVE4<45>AssertionError<6F>codes<65>vertices)r<><00>insiderY<00> reorder_inoutr<74><00> path_iter<65>
ctl_points<EFBFBD>command<6E> begin_inside<64>ctl_points_old<6C>ioldr<00> bezier_path<74>bp<62>left<66>right<68>
codes_left<EFBFBD> codes_right<68>
verts_left<EFBFBD> verts_right<68>path_in<69>path_outs r<00>split_path_inoutr<74>_s<><00><00>
<1B><14>"<22>"<22>$<24>I<EFBFBD><1E>y<EFBFBD>/<2F><17>J<EFBFBD><07><19>*<2A>R<EFBFBD>S<EFBFBD>/<2F>*<2A>L<EFBFBD><1F>N<EFBFBD> <0C>D<EFBFBD> <09>A<EFBFBD>(<28>G<01><1B>
<EFBFBD>G<EFBFBD><10><04> <09>S<EFBFBD><1A>_<EFBFBD><01> !<21>!<21><01> <11>*<2A>R<EFBFBD>S<EFBFBD>/<2F> "<22>l<EFBFBD> 2<><1C>.<2E>.<2E>.<2E><12><13>*=<3D>z<EFBFBD>)J<>K<>K<EFBFBD> <11>#<23><0E> G<01><19>E<>F<>F<> <14> <1C> <1C>W<EFBFBD> %<25>B<EFBFBD>;<3B>
<EFBFBD>F<EFBFBD>I<EFBFBD><1F>K<EFBFBD>D<EFBFBD>%<25>
<EFBFBD>4<EFBFBD>y<EFBFBD>A<EFBFBD>~<7E><1A>k<EFBFBD>k<EFBFBD>]<5D>
<EFBFBD><1B>{<7B>{<7B>D<EFBFBD>K<EFBFBD>K<EFBFBD>0<> <0B> <0C>T<EFBFBD><19>a<EFBFBD><1E><1A>k<EFBFBD>k<EFBFBD>4<EFBFBD>;<3B>;<3B>/<2F>
<EFBFBD><1B>{<7B>{<7B>D<EFBFBD>K<EFBFBD>K<EFBFBD><14><1B><1B>=<3D> <0B> <0C>T<EFBFBD><19>a<EFBFBD><1E><1A>k<EFBFBD>k<EFBFBD>4<EFBFBD>;<3B>;<3B><04> <0B> <0B><<3C>
<EFBFBD><1B>{<7B>{<7B>D<EFBFBD>K<EFBFBD>K<EFBFBD><14><1B><1B>d<EFBFBD>k<EFBFBD>k<EFBFBD>J<> <0B><1C>;<3B><<3C><<3C><15>a<EFBFBD>b<EFBFBD><18>J<EFBFBD><17><01>(<28>K<EFBFBD> <0B>z<EFBFBD>z<EFBFBD><19><16>r<EFBFBD>~<7E>~<7E>t<EFBFBD>}<7D>}<7D>R<EFBFBD>a<EFBFBD>'8<>*<2A>&E<>F<>G<><07><17><02><0E><0E> <0B>T<EFBFBD>]<5D>]<5D>1<EFBFBD>2<EFBFBD>5F<35>'G<>H<>I<><08><17>r<EFBFBD>~<7E>~<7E>t<EFBFBD>}<7D>}<7D>U<EFBFBD>d<EFBFBD>';<3B>Z<EFBFBD>&H<>I<><19>~<7E>~<7E>t<EFBFBD>z<EFBFBD>z<EFBFBD>%<25>4<EFBFBD>'8<>*<2A>&E<>F<>H<01><07><18><02><0E><0E> <0B>T<EFBFBD>]<5D>]<5D>1<EFBFBD>2<EFBFBD>5F<35>'G<>H<><1A><0E><0E> <0B>T<EFBFBD>Z<EFBFBD>Z<EFBFBD><01><02>^<5E>'D<>E<>G<01><08><15>\<5C>$<24>g<EFBFBD><18><07> <12>H<EFBFBD> <1C>rc<00>$<00><00><01><04>|dz<00><04><00><01>fd<02>}|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<00>6<00><03>|\}}|<01>z
dz|<02>z
dzz<00>kS)Nr<4E>r)<06>xyr4r5r9r:<00>r2s <20><><EFBFBD>r<00>_fzinside_circle.<locals>._f<5F>s,<00><><00><11><04><01>1<EFBFBD><11>B<EFBFBD><06>1<EFBFBD>}<7D><01>B<EFBFBD><06>1<EFBFBD>}<7D>,<2C>r<EFBFBD>1<>1rr)r9r:r<>r<>r<>s`` @r<00> inside_circler<65><00>s<00><><00>
<0B>a<EFBFBD><16>B<EFBFBD>2<> <0E>Irc<00>R<00>||z
||z
}}||z||zzdz}|dk(ry||z ||z fS)NrSr)r8r8r)<07>x0<78>y0r>r?<00>dx<64>dyr/s r<00> get_cos_sinr<6E><00>sF<00><00> <0F>"<22>W<EFBFBD>b<EFBFBD>2<EFBFBD>g<EFBFBD><02>B<EFBFBD> <0B>b<EFBFBD><17>2<EFBFBD><02>7<EFBFBD> <1A>r<EFBFBD>!<21>A<EFBFBD><08>A<EFBFBD>v<EFBFBD><17> <0A><01>6<EFBFBD>2<EFBFBD><01>6<EFBFBD>><3E>rc<00><><00>tj||<01>}tj||<03>}t||z
<00>}||kryt|tjz
<00>|kryy)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.
rrDF)r
<00>arctan2r r<>)<08>dx1<78>dy1<79>dx2<78>dy2rY<00>theta1<61>theta2<61>dthetas r<00>check_if_parallelr<6C><00>sX<00><00>&<10>Z<EFBFBD>Z<EFBFBD><03>S<EFBFBD> !<21>F<EFBFBD> <0F>Z<EFBFBD>Z<EFBFBD><03>S<EFBFBD> !<21>F<EFBFBD> <10><16>&<26><1F> !<21>F<EFBFBD> <0A> <09><19><10> <0C>V<EFBFBD>b<EFBFBD>e<EFBFBD>e<EFBFBD>^<5E> <1C>y<EFBFBD> (<28><11>rc
<00>B<00>|d\}}|d\}}|d\}}t||z
||z
||z
||z
<00>}|dk(r+tjd<05>t||||<07>\} }
| |
} } n"t||||<05>\} }
t||||<07>\} } t ||| |
|<01>\} }}}t ||| | |<01>\}}}} t | || |
||| | <0C>\}}t ||| |
||| | <0C>\}}| |f||f||fg}||f||f||fg}||fS#t $r#d| |zzd||zz}}d||zzd||zz}}Y<00>EwxYw)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*.
rrr<>rDz8Lines do not intersect. A straight line is used instead.rS)r<>r<00> warn_externalr<6C>rBr6r!)<1B>bezier2<72>width<74>c1x<31>c1y<31>cmx<6D>cmy<6D>c2x<32>c2y<32> parallel_testr$r%r(r)<00>c1x_left<66>c1y_left<66> c1x_right<68> c1y_right<68>c2x_left<66>c2y_left<66> c2x_right<68> c2y_right<68>cmx_left<66>cmy_left<66> cmx_right<68> cmy_right<68> path_left<66>
path_rights r<00> get_parallelsr<73><00>s<><00><00><17>q<EFBFBD>z<EFBFBD>H<EFBFBD>C<EFBFBD><13><16>q<EFBFBD>z<EFBFBD>H<EFBFBD>C<EFBFBD><13><16>q<EFBFBD>z<EFBFBD>H<EFBFBD>C<EFBFBD><13>%<25>c<EFBFBD>C<EFBFBD>i<EFBFBD><13>s<EFBFBD><19>&)<29>C<EFBFBD>i<EFBFBD><13>s<EFBFBD><19><<3C>M<EFBFBD><15><02><1A> <0C><1A><1A> F<> H<01>$<24>S<EFBFBD>#<23>s<EFBFBD>C<EFBFBD>8<><0E><06><06><1F><16><06><06>%<25>S<EFBFBD>#<23>s<EFBFBD>C<EFBFBD>8<><0E><06><06>$<24>S<EFBFBD>#<23>s<EFBFBD>C<EFBFBD>8<><0E><06><06> <1A>#<23>s<EFBFBD>F<EFBFBD>F<EFBFBD>E<EFBFBD>:<3A>-<2D>H<EFBFBD>h<EFBFBD> <09>9<EFBFBD> <1A>#<23>s<EFBFBD>F<EFBFBD>F<EFBFBD>E<EFBFBD>:<3A>-<2D>H<EFBFBD>h<EFBFBD> <09>9<EFBFBD>
<EFBFBD>-<2D>h<EFBFBD><08>&<26>.4<EFBFBD>h<EFBFBD><08>.4<EFBFBD>f<EFBFBD>><3E><1A><08>(<28> 0<> <09>9<EFBFBD>f<EFBFBD>06<30> <09>9<EFBFBD>06<30><06> @<01><1C> <09>9<EFBFBD> <1B>H<EFBFBD>%<25><1A>H<EFBFBD>%<25><1A>H<EFBFBD>%<25>'<27>I<EFBFBD><1D>i<EFBFBD>(<28><1C>i<EFBFBD>(<28><1C>i<EFBFBD>(<28>*<2A>J<EFBFBD> <15>j<EFBFBD> <20> <20><>) <16> 
<EFBFBD>
<10>8<EFBFBD>h<EFBFBD>&<26> '<27><13><08>8<EFBFBD>0C<30>)D<><1B><08> <10>9<EFBFBD>y<EFBFBD>(<28> )<29>3<EFBFBD>)<29>i<EFBFBD>2G<32>+H<><1D> <09> 
<EFBFBD>s<00>.*C2<00>2)D<03>Dc<00>P<00>dd|z||zz
z}dd|z||zz
z}||f||f||fgS)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.
rSr<>r)r<>r<><00>mmx<6D>mmyr<79>r<>r<>r<>s r<00>find_control_pointsr<73> sK<00><00>
<0A><01>C<EFBFBD><07>3<EFBFBD><13>9<EFBFBD>%<25>
&<26>C<EFBFBD>
<0C><01>C<EFBFBD><07>3<EFBFBD><13>9<EFBFBD>%<25>
&<26>C<EFBFBD> <10>#<23>J<EFBFBD><13>c<EFBFBD>
<EFBFBD>S<EFBFBD>#<23>J<EFBFBD> /<2F>/rc<00><><00>|d\}}|d\}}|d\} }
t||||<08>\} } t||| |
<EFBFBD>\} }t||| | ||z<00>\}}}}t| |
| |||z<00>\}}}}||zdz||zdz}}|| zdz||
zdz}}||zdz||zdz}}t||||<1A>\}}t||||||z<00>\}} }!}"t|||| ||<14>}#t|||!|"||<16>}$|#|$fS)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*.
rrr<>rS)r<>rBr<>)%r<>r<><00>w1<77>wm<77>w2r<32>r<>r<>r<><00>c3x<33>c3yr$r%r(r)r<>r<>r<>r<><00>c3x_left<66>c3y_left<66> c3x_right<68> c3y_right<68>c12x<32>c12y<32>c23x<33>c23y<33>c123x<33>c123y<33>cos_t123<32>sin_t123<32>
c123x_left<EFBFBD>
c123y_left<EFBFBD> c123x_right<68> c123y_rightr<74>r<>s% r<00>make_wedged_bezier2r*si<00><00><17>q<EFBFBD>z<EFBFBD>H<EFBFBD>C<EFBFBD><13><16>q<EFBFBD>z<EFBFBD>H<EFBFBD>C<EFBFBD><13><16>q<EFBFBD>z<EFBFBD>H<EFBFBD>C<EFBFBD><13>!<21><13>c<EFBFBD>3<EFBFBD><03>4<>N<EFBFBD>F<EFBFBD>F<EFBFBD> <20><13>c<EFBFBD>3<EFBFBD><03>4<>N<EFBFBD>F<EFBFBD>F<EFBFBD> <1A>#<23>s<EFBFBD>F<EFBFBD>F<EFBFBD>E<EFBFBD>B<EFBFBD>J<EFBFBD>?<3F>-<2D>H<EFBFBD>h<EFBFBD> <09>9<EFBFBD> <1A>#<23>s<EFBFBD>F<EFBFBD>F<EFBFBD>E<EFBFBD>B<EFBFBD>J<EFBFBD>?<3F>-<2D>H<EFBFBD>h<EFBFBD> <09>9<EFBFBD> <16><03>)<29>r<EFBFBD>!<21>C<EFBFBD>#<23>I<EFBFBD><12>#3<>$<24>D<EFBFBD><15><03>)<29>r<EFBFBD>!<21>C<EFBFBD>#<23>I<EFBFBD><12>#3<>$<24>D<EFBFBD><18>4<EFBFBD>K<EFBFBD>2<EFBFBD>%<25><04>t<EFBFBD> <0B>r<EFBFBD>'9<>5<EFBFBD>E<EFBFBD>%<25>T<EFBFBD>4<EFBFBD><14>t<EFBFBD><<3C><16>H<EFBFBD>h<EFBFBD> <1A>%<25><15><08>(<28>E<EFBFBD>B<EFBFBD>J<EFBFBD>G<>5<>J<EFBFBD>
<EFBFBD>K<EFBFBD><1B>$<24>H<EFBFBD>h<EFBFBD>$.<2E>
<EFBFBD>$,<2C>h<EFBFBD>8<>I<EFBFBD>%<25>Y<EFBFBD> <09>%0<>+<2B>%.<2E> <09>;<3B>J<EFBFBD> <15>j<EFBFBD> <20> r)r8<00><00>?<3F>{<14>G<EFBFBD>z<EFBFBD>?)r)rF)g<>h㈵<68><E388B5>>)rrSr8)r<><00> functoolsrrkr<><00>numpyr
<00>
matplotlibr<00> vectorizerr!rr6rBrHrQrarcr<>r<>r<>r<>r<>r<>r<>rrrr<00><module>rs<><00><01><04> <20> <0B><0F><12><1B><04><1C><1C>
<EFBFBD>3<EFBFBD><17>.<2E><18><0E>.<2E> <09>:<3A> <09><10>B<1A>2<15>
!<21>&GK<01>I)<29>X|8<>|8<>@.2<EFBFBD><19>F:<1D>z<0E>&<1A><15><G!<21>T0<>0!r