Ë
    /¾ªjÌ  ã                   óh   — d dl mZ d dlmZ d dlmZ g d¢Z edddg«      Z edg d	¢«      Zd
„ Z	d„ Z
y)é    )Ú
namedtuple)Úchain)Ú
itemgetter)Úbounding_boxÚconvex_hullÚPointÚRectr   ÚxÚyr	   )ÚleftÚtopÚwidthÚheightc                 óú   — t        t        t        d«      | «      «      }t        |«      t	        |«      }}t        t        t        d«      | «      «      }t        |«      t	        |«      }}t        ||||z
  ||z
  «      S )z¼Computes the bounding box of an iterable of (x, y) coordinates.

    Args:
        locations: iterable of (x, y) tuples.

    Returns:
        `Rect`: Coordinates of the bounding box.
    r   é   )ÚlistÚmapr   ÚminÚmaxr	   )Ú	locationsÚx_valuesÚx_minÚx_maxÚy_valuesÚy_minÚy_maxs          úO/var/www/html/serviGia/entorno/lib/python3.12/site-packages/pyzbar/locations.pyr   r      si   € ô ”Cœ
 1› yÓ1Ó2€HÜ�x“=¤# h£-ˆ5€EÜ”Cœ
 1› yÓ1Ó2€HÜ�x“=¤# h£-ˆ5€EÜ��u˜e e™m¨U°U©]Ó;Ð;ó    c                 óä   ‡— d„ Šˆfd„}t        t        | «      «      } t        | «      dk  r| n t         || «       |t	        | «      «      «      }t        t        t        j                  |«      «      S )aÞ  Computes the convex hull of an iterable of (x, y) coordinates.

    Args:
        points: iterable of (x, y) tuples.

    Returns:
        `list`: instances of `Point` - vertices of the convex hull in
        counter-clockwise order, starting from the vertex with the
        lexicographically smallest coordinates.

    Andrew's monotone chain algorithm. O(n log n) complexity.
    https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain
    c                 óf   — d|d   | d   z
  |d   | d   z
  z  |d   | d   z
  |d   | d   z
  z  z
  k  S )Nr   r   © )Úp0Úp1Úp2s      r   Úis_not_clockwisez%convex_hull.<locals>.is_not_clockwise,   sT   € ØØ�‰U�R˜‘U‰]˜r !™u r¨!¡u™}Ñ-Ø�‰U�R˜‘U‰]˜r !™u r¨!¡u™}Ñ-ñ.ñ
ð 	
r   c                 óö   •— g }| D ]`  }dt        |«      k  r? ‰|d   |d   |«      r/|j                  «        dt        |«      k  r ‰|d   |d   |«      rŒ/|j                  |«       Œb |j                  «        |S )Nr   éþÿÿÿéÿÿÿÿ)ÚlenÚpopÚappend)Úpoints_ÚresÚpr%   s      €r   Úgozconvex_hull.<locals>.go2   s{   ø€ ØˆØò 	ˆAØ”c˜#“h’,Ñ#3°C¸±G¸SÀ¹WÀaÔ#HØ—‘”	ð ”c˜#“h’,Ñ#3°C¸±G¸SÀ¹WÀaÕ#Hà�J‰J�q�Mð	ð 	�‰Œ	àˆ
r   é   )	ÚsortedÚsetr)   r   Úreversedr   r   r   Ú_make)Úpointsr/   Úhullr%   s      @r   r   r      s`   ø€ ò
ô
ô ”C˜“KÓ €Fô �f“+ ’/‰¤u©R°«Z¹¼HÀVÓ<LÓ9MÓ'Nð 	ô ””E—K‘K Ó&Ó'Ð'r   N)Úcollectionsr   Ú	itertoolsr   Úoperatorr   Ú__all__r   r	   r   r   r!   r   r   ú<module>r;      s>   ðÝ "Ý Ý ò ;€ñ 	�7˜S #˜JÓ'€Ù�&Ò<Ó=€ò<ó )(r   