Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/matplotlib/__pycache__/bezier.cpython-37.pyc

125 lines
12 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
U<>]<5D>;<00>@s$dZddlZddlmZddlmZGdd<05>de<07>Zdd<07>Z dd <09>Z
d
d <0B>Z d d <0A>Z e<04> ddd<10>d1dd<15><01>ZGdd<17>de<0F>Ze<04> ddd<10>d2dd<19><01>Ze<04>d<0E>e<04> ddd<10>d3dd<1B><01><01>Ze<04> ddd<10>d4dd<1E><01>Zdd <20>Zd!d"<22>Ze<04> ddd<10>d5d$d%<25><01>Zd&d'<27>Zd(d)<29>Zd6d+d,<2C>Zd-d.<2E>Zd/d0<64>ZdS)7zO
A module providing some utility functions regarding bezier path manipulation.
<EFBFBD>N)<01>Pathc@s eZdZdS)<02>NonIntersectingPathExceptionN)<03>__name__<5F>
__module__<EFBFBD> __qualname__<5F>rr<00>9/tmp/pip-install-i8dhxrtk/matplotlib/matplotlib/bezier.pyr srcs<>||||}||||} || }
} || } } |
| | | <00>t<00><01><00>dkr^td<02><01>| | }}| |
}}<11>fdd<04>||||gD<00>\}}}}|||| }|||| }||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.csg|] }|<01><00>qSrr)<02>.0<EFBFBD>k)<01>ad_bcrr<00>
<listcomp>*sz$get_intersection.<locals>.<listcomp>)<03>np<6E>abs<62>
ValueError)Zcx1Zcy1<79>cos_t1<74>sin_t1Zcx2Zcy2<79>cos_t2<74>sin_t2Z line1_rhsZ line2_rhs<68>a<>b<>c<>dZa_Zb_Zc_Zd_<64>x<>yr)r r<00>get_intersections
    "rc Csl|dkr||||fS|| }}| |}}||||||} }
||||||} } | |
| | fS)z<>
For a line passing through (*cx*, *cy*) and having a angle *t*, return
locations of the two points located along its perpendicular line at the
distance of *length*.
gr) <0A>cx<63>cy<63>cos_t<5F>sin_t<5F>lengthrrrr<00>x1<78>y1Zx2<78>y2rrr<00>get_normal_points2s   r#cCs(|dd<01>d||dd<00>|}|S)N<><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>r)<03>beta<74>tZ next_betarrr<00>_de_casteljau1Ks$r(cCs`t<00>|<00>}|g}x&t||<01>}|<02>|<00>t|<00>dkrPqWdd<03>|D<00>}dd<03>t|<02>D<00>}||fS)z<>
Split a bezier segment defined by its control points *beta* into two
separate segments divided at *t* and return their control points.
r%cSsg|] }|d<00>qS)rr)r r&rrrr \sz&split_de_casteljau.<locals>.<listcomp>cSsg|] }|d<00>qS)r$r)r r&rrrr ]s)r <00>asarrayr(<00>append<6E>len<65>reversed)r&r'Z beta_listZ left_betaZ
right_betarrr<00>split_de_casteljauPs


 r-z3.1Z tolerence<63> tolerance<63><00><00>?<3F>{<14>G<EFBFBD>z<EFBFBD>?c Cs<>||<02>}||<03>}||<05>}||<06>}||kr8||kr8td<01><01>xrt<01>|d|d|d|d<00>|krj||fSd||} || <09>}
||
<EFBFBD>} || Ar<>| }|
}| }q:| }|
}| }q:WdS)a$ Find a parameter t0 and t1 of the given bezier path which
bounds the intersecting points with a provided closed
path(*inside_closedpath*). Search starts from *t0* and *t1* and it
uses a simple bisecting algorithm therefore one of the end point
must be inside the path while the other doesn't. The search stop
when |t0-t1| gets smaller than the given tolerance.
value for
- bezier_point_at_t : a function which returns x, y coordinates at *t*
- inside_closedpath : return True if the point is inside the path
z3Both points are on the same side of the closed pathrr%g<00>?N)rr <00>hypot) <0C>bezier_point_at_t<5F>inside_closedpath<74>t0<74>t1r.<00>start<72>endZ start_insideZ
end_insideZmiddle_tZmiddleZ middle_insiderrr<00>*find_bezier_t_intersecting_with_closedpathbs(( r9c@sPeZdZdZe<04>ddg<02>e<04>dddg<03>e<04>ddddg<04>d<05>Zdd<07>Zdd <09>Zd
S) <0B> BezierSegmentz:
A simple class of a 2-dimensional bezier segment
g<00>?g@g@)r%<00><00>cCsJt|<01>}t<01>|<02>|_tj|d}t<01>|<01>j\}}|||_|||_ dS)z<>
*control_points* : location of contol points. It needs have a
shape of n * 2, where n is the order of the bezier line. 1<=
n <= 3 is supported.
r%N)
r+r Zarange<67>_ordersr:<00> _binom_coeffr)<00>T<>_px<70>_py)<06>selfZcontrol_pointsZ_oZ_coeffZxx<78>yyrrr<00>__init__<5F>s  
zBezierSegment.__init__cCsFd||jddd<03>||j}t<01>||j<03>}t<01>||j<04>}||fS)zevaluate a point at tr%Nr$)r=r <00>dotr@rA)rBr'<00>tt<74>_xZ_yrrr<00>
point_at_t<EFBFBD>s"zBezierSegment.point_at_tN) rrr<00>__doc__r <00>arrayr>rDrHrrrrr:<00>s  r:c Cs>t|<00>}|j}t|||d<01>\}}t|||d<00>\}}||fS)z<>
bezier : control points of the bezier segment
inside_closedpath : a function which returns true if the point is inside
the path
)r.g@)r:rHr9r-) Zbezierr4r.Zbzr3r5r6<00>_leftZ_rightrrr<00>)split_bezier_intersecting_with_closedpath<74>s
rLcs0|\<02><01><02><00><01><02>fdd<02>}t|||||d<03>dS)z<>
Find a radius r (centered at *xy*) between *rmin* and *rmax* at
which it intersect with the path.
inside_closedpath : function
cx, cy : center
cos_t, sin_t : cosine and sine for the angle
rmin, rmax :
cs<00>|<00><00>|<00>fS)Nr)<01>r)rrrrrr<00>_f<5F>sz,find_r_to_boundary_of_closedpath.<locals>._f)r5r6r.N)r9)r4<00>xyrrZrminZrmaxr.rNr)rrrrr<00> find_r_to_boundary_of_closedpath<74>srPFcCs|<00><00>}t|<04>\}}||dd<02><00>}|}tj} d}
d} xZ|D]J\}}| }
| t|<05>d7} ||dd<02><00>|kr<>| |dd<02>|g<02>} P|}q<Wtd<06><01>| <0C>d<07>} t| ||<02>\}}t|<0E>dkr<>tj g}tj
tj g}nft|<0E>dkr<>tj tj g}tj
tj tj g}n<t|<0E>d k<02>r,tj tj tj g}tj
tj tj tj g}nt d
<EFBFBD><01>|dd<02>}|dd<02>}|jdk<08>r<>t| |jd| <0B>|g<02><01>}t| ||j| d<02>g<02><01>}n\t| |jd|
<EFBFBD>|g<02>| |jd|
<EFBFBD>|g<02><01>}t| ||j| d<02>g<02>| ||j| d<02>g<02><01>}|<03>r|<07>s||}}||fS) zW divide a path into two segment at the point where inside(x, y)
becomes False.
<20><><EFBFBD><EFBFBD><EFBFBD>Nrr%r;z*The path does not intersect with the patch)r$r;r<<00>zThis should never be reached)Z iter_segments<74>nextr <00> concatenater+rZreshaperLr<00>LINETO<54>MOVETOZCURVE3ZCURVE4<45>AssertionError<6F>codes<65>vertices)<16>pathZinsider.Z reorder_inoutZ path_iterZ
ctl_points<EFBFBD>commandZ begin_insideZctl_points_old<6C>concatZiold<6C>iZ bezier_pathZbp<62>left<66>rightZ
codes_leftZ codes_rightZ
verts_leftZ verts_rightZpath_inZpath_outrrr<00>split_path_inout<75>sP 
       
r`cs|d<00><02><00><01>fdd<03>}|S)Nr;cs$|\}}|<01>d|<02>d<00>kS)Nr;r)rOrr)rr<00>r2rrrN#szinside_circle.<locals>._fr)rrrMrNr)rrrar<00> inside_circle srbcCsB||||}}||||d}|dkr2dS||||fS)Ng<00>?r)ggr)Zx0Zy0r r!ZdxZdyrrrr<00> get_cos_sin+s
rc<00><>h㈵<68><E388B5>>cCsRt<00>||<01>}t<00>||<03>}t<00>||<00>}||kr2dSt<00>|tj<00>|krJdSdSdS)z<> returns
* 1 if two lines are parallel in same direction
* -1 if two lines are parallel in opposite direction
* 0 otherwise
r%r$FN)r Zarctan2r<00>pi)Zdx1Zdy1Zdx2Zdy2r.Ztheta1Ztheta2Zdthetarrr<00>check_if_parallel4s  rfc Csn|d\}}|d\}}|d\}}t||||||||<00>}|dkrrt<01>d<05>t||||<07>\} }
| |
} } n$t||||<05>\} }
t||||<07>\} } t||| |
|<01>\} }}}t||| | |<01>\}}}}|dk<03>rd| |d||}}d||d||}}n4t| || |
||| | <0C>\}}t||| |
||| | <0C>\}}| |f||f||fg}||f||f||fg}||fS)z<>
Given the quadratic bezier control points *bezier2*, returns
control points of quadratic bezier lines roughly parallel to given
one separated by *width*.
rr%r;r$z8Lines do not intersect. A straight line is used instead.g<00>?)rf<00>cbookZ_warn_externalrcr#r)<1B>bezier2<72>width<74>c1x<31>c1y<31>cmx<6D>cmy<6D>c2x<32>c2yZ parallel_testrrrr<00>c1x_left<66>c1y_left<66> c1x_right<68> c1y_rightZc2x_leftZc2y_leftZ c2x_rightZ c2y_rightZcmx_leftZcmy_leftZ cmx_rightZ cmy_right<68> path_left<66>
path_rightrrr<00> get_parallelsFs<    
  

rvcCs>dd|||}dd|||}||f||f||fgS)z<>
Find control points of the Bezier curve passing through (*c1x*, *c1y*),
(*mmx*, *mmy*), and (*c2x*, *c2y*), at parametric values 0, 0.5, and 1.
g<00>?rRr)rjrkZmmxZmmyrnrorlrmrrr<00>find_control_points<74>srw<00><00>?c%Cs(|d\}}|d\}}|d\} }
t||||<08>\} } t||| |
<EFBFBD>\} }t||| | ||<00>\}}}}t| |
| |||<00>\}}}}||d||d}}|| d||
d}}||d||d}}t||||<1A>\}}t||||||<00>\}} }!}"t|||| ||<14>}#t|||!|"||<16>}$|#|$fS)z<>
Being similar to get_parallels, returns control points of two quadratic
bezier lines having a width roughly parallel to given one separated by
*width*.
rr%r;g<00>?)rcr#rw)%rhriZw1ZwmZw2rjrkrlrmZc3xZc3yrrrrrprqrrrsZc3x_leftZc3y_leftZ c3x_rightZ c3y_rightZc12xZc12yZc23xZc23yZc123xZc123yZcos_t123Zsin_t123Z
c123x_leftZ
c123y_leftZ c123x_rightZ c123y_rightrtrurrr<00>make_wedged_bezier2<72>s&   rycCsF|j}|dkr>tjt|j<04>tjtjd<02>}tj|d<t|j|<01>S|SdS)z<>
If the :attr:`codes` attribute of `Path` *p* is None, return a copy of *p*
with the :attr:`codes` set to (MOVETO, LINETO, LINETO, ..., LINETO);
otherwise return *p* itself.
N)Zdtyper) rXr <00>fullr+rYrrUZ code_typerV)<02>prrrr<00>make_path_regular<61>s 
 r|cCs2t<00>dd<02>|D<00><01>}t<00>dd<02>|D<00><01>}t||<02>S)z/Concatenate a list of paths into a single path.cSsg|]
}|j<00>qSr)rY)r r{rrrr <00>sz%concatenate_paths.<locals>.<listcomp>cSsg|]}t|<01>j<01>qSr)r|rX)r r{rrrr <00>s)r rTr)<03>pathsrYrXrrr<00>concatenate_paths<68>sr~)r/r0r1)r1)r/r0r1)r1F)rd)r0rxr/)rIZnumpyr Zmatplotlib.cbookrgZmatplotlib.pathrrrrr#r(r-Z_rename_parameterr9<00>objectr:rL<00>
deprecatedrPr`rbrcrfrvrwryr|r~rrrr<00><module>s6  !  /!     >   J
3