+
    Ai                         ^ RI t^ RIHt R t^^^.^^.3^^^.^^.3^. RO. RO3^. RO. RO3^. R	O. R
O3^. RO. RO3^. RO. RO3/tRR ltR# )    N)signalc                   V^ 8:  d   V # \         P                  ! V P                  ^ ,          R4      p\         P                  ! V P                  ^ ,          4      pRV^ &   RVR&   ^ VP                  ^ ,          ^,
          3.pRpV'       Eg   VP                  4       w  rgWR3,          w  rWR3,          w  rW,
          pW,
          p\         P                  ! W4      ) pV	\         P
                  ! V4      ,          V\         P                  ! V4      ,          ,           pW^,           V1R3,          pW6^,           V pVR,          V,
          pVR,          V	,
          pVR,          V
,
          pVR,          V,
          pVV,          VV,          ,           pV) V,          VV,          ,
          p\         P                  ! V^ 8  V^ 8  4      p\         P                  ! V4      p\         P                  ! VV^ 3,          \         P                  ! V4      ,          VV^3,          \         P
                  ! V4      ,          ,           V,
          4      VV&   \         P                  ! \         P                  ! VV,          ^,          VV,          ^,          ,           4      \         P                  ! VV,          ^,          VV,          ^,          ,           4      4      VV&   \         P                  ! VV8  4      '       dP   V\         P                  ! V4      ,           ^,           pVP                  VV34       VP                  VV34       RVV&   \        V4      ^ 8X  g   EK  RpEK  WR3,          # )al  Approximate a polygonal chain with the specified tolerance.

It is based on the Douglas-Peucker algorithm.

Note that the approximated polygon is always within the convex hull of the
original polygon.

Parameters
----------
coords : (K, 2) array
    Coordinate array.
tolerance : float
    Maximum distance from original points of polygon to approximated
    polygonal chain. If tolerance is 0, the original coordinate array
    is returned.

Returns
-------
coords : (L, 2) array
    Approximated polygonal chain where L <= K.

References
----------
.. [1] https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
boolTFNNN)r   r   )r      )npzerosshapepoparctan2sincoslogical_andlogical_notabsminimumsqrtanyargmaxappendlen)coords	tolerancechaindists	pos_stackend_of_chainstartendr0c0r1c1drdcsegment_anglesegment_distsegment_coordssegment_distsdr0dc0dr1dc1projected_lengths0projected_lengths1perpeuclnew_ends   &&                         V/var/www/html/photoedit/myenv/lib/python3.14/site-packages/skimage/measure/_polygon.pyapproximate_polygonr5      s   4 A~HHV\\!_f-EHHV\\!_%EE!HE"IU[[^a'()ILl]]_
q!QWWB++BFF=11B9N4NN  	C 23ai#. T"R'T"R'T"R'T"R' 2Xb0!TBYr1~~0146H16LM~~d# ff47#bff]&;;T1W%}(==>
d
 !jjGGCINSY!^34GGCINSY!^34	
d 66-)+,,bii66:Ggs^,eW-.!E'Ny>QL(    c                   V\         9  d   \        R4      h\        P                  ! V R
,          V R,          8H  4      pRpV'       d   V RR1R3,          p Rp\         V,          w  rV\        P                  ! V\
        4      ^V,          ,          p\        P                  ! V\
        4      ^V,          ,          p\        P                  ! V P                  \        P                  ! V4      VRR7      p\        P                  ! V P                  \        P                  ! V4      VRR7      p\        P                  ! VP                  ^,          VP                  ^,          ,           ^34      p	VP                  V	R&   VP                  V	R	&   V'       d   \        P                  ! WR
,          .4      p	V'       d/   V'       g'   \        P                  ! V R
,          WR,          .4      p	V	# )al  Subdivision of polygonal curves using B-Splines.

Note that the resulting curve is always within the convex hull of the
original polygon. Circular polygons stay closed after subdivision.

Parameters
----------
coords : (K, 2) array
    Coordinate array.
degree : {1, 2, 3, 4, 5, 6, 7}, optional
    Degree of B-Spline. Default is 2.
preserve_ends : bool, optional
    Preserve first and last coordinate of non-circular polygon. Default is
    False.

Returns
-------
coords : (L, 2) array
    Subdivided coordinate array.

References
----------
.. [1] http://mrl.nyu.edu/publications/subdiv-course2000/coursenotes00.pdf
z8Invalid B-Spline degree. Only degree 1 - 7 is supported.r   validNsamewrap)modeboundary:r   N   :NNr=   )r   r   r   )r   r   )_SUBDIVISION_MASKS
ValueErrorr	   allarrayfloatr   
convolve2dT
atleast_2dr
   r   vstack)
r   degreepreserve_endscircularmethod	mask_evenmask_oddevenoddouts
   &&&       r4   subdivide_polygonrP   l   s`   2 ''VWWvvfTlfUm34HFQ,V4IE*ai8Ixx%(AvI6H"--	*&D 

"--)C ((DJJqMCIIaL0!4
5CCIuuCHii$i()Xiis5M:;Jr6   )r      r   )r      rR   )   
   r   )r   rT   rS   )r      rU   r   )r   rQ      rQ   )   #      r   )r   rY   rX   rW   )r      F   rZ   r   )r      8   r]   r\   )r=   F)numpyr	   scipyr   r5   r>   rP    r6   r4   <module>ra      sy     Vz AAAA	9
J&'-.
 <r6   