
    9i?                     D    S S/r SSKrSSKJr  \" SS5      S 5       rS	 rg)
polygon_clippolygon_area    N   )require
matplotlibz>=3.3c                    SSK JnJn  UR                  [        R
                  " X45      R                  SS9nUR                  X#/XE//5      n	UR                  U	5      R                  5       S   n
U
SS2S4   U
SS2S4   4$ )a  Clip a polygon to the given bounding box.

Parameters
----------
rp, cp : (K,) ndarray of double
    Row and column coordinates of the polygon.
(r0, c0), (r1, c1) : double
    Top-left and bottom-right coordinates of the bounding box.

Returns
-------
r_clipped, c_clipped : (L,) ndarray of double
    Coordinates of clipped polygon.

Notes
-----
This makes use of Sutherland-Hodgman clipping as implemented in
AGG 2.4 and exposed in Matplotlib.

r   )path
transformsT)closedNr   )
r   r	   r
   PathnpvstackTBboxclip_to_bboxto_polygons)rpcpr0c0r1c1r	   r
   poly	clip_rectpoly_clippeds              Y/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/skimage/_shared/_geometry.pyr   r      s|    , ,99RYYx(**498D"B8 45I$$Y/;;=a@L1|AqD111    c           
          [         R                  " U 5      n [         R                  " U5      nS[         R                  " [         R                  " USS U SS -  USS U SS -  -
  5      5      -  $ )zCompute the area of a polygon.

Parameters
----------
pr, pc : (K,) array of float
    Polygon row and column coordinates.

Returns
-------
a : float
    Area of the polygon.
g      ?Nr   )r   asarrayabssum)prpcs     r   r   r   '   sb     
BB	BB3B"QR& 0RVb"g5EFGHHHr   )__all__numpyr   version_requirementsr   r   r    r   r   <module>r)      s6   >
*  ) 	w2  2<Ir   