Ë
    ¼Ó^jp  ã                  ó¤   — d dl mZ d dlmZ d dlmZ d dlmZ  G d„ de«      Ze G d„ d«      «       Z	e G d	„ d
«      «       Z
e G d„ d«      «       Zy)é    )Úannotations)Ú	dataclass)ÚEnum)Úsqrtc                  óJ   — e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZedd„«       Zy)ÚPositionz<
    Enum representing the position of an anchor point.
    ÚCENTERÚCENTER_LEFTÚCENTER_RIGHTÚ
TOP_CENTERÚTOP_LEFTÚ	TOP_RIGHTÚBOTTOM_LEFTÚBOTTOM_CENTERÚBOTTOM_RIGHTÚCENTER_OF_MASSc                ó.   — t        t        d„ | «      «      S )Nc                ó   — | j                   S ©N)Úvalue)Úcs    úd/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/supervision/geometry/core.pyú<lambda>zPosition.list.<locals>.<lambda>   s
   €  !§'¡'€ ó    )ÚlistÚmap)Úclss    r   r   zPosition.list   s   € ä”CÑ)¨3Ó/Ó0Ð0r   N)Úreturnz	list[str])Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   r
   r   r   r   r   r   r   r   r   Úclassmethodr   © r   r   r   r      sM   „ ñð €FØ€KØ!€LØ€JØ€HØ€IØ€KØ#€MØ!€LØ%€Nàò1ó ñ1r   r   c                  ó6   — e Zd ZU dZded<   ded<   dd„Zd	d„Zy)
ÚPointaŒ  
    Represents a point in 2D space.

    Attributes:
        x: The x-coordinate of the point.
        y: The y-coordinate of the point.

    Example:
        ```pycon
        >>> from supervision.geometry.core import Point
        >>> point = Point(x=10.0, y=20.0)
        >>> point.as_xy_int_tuple()
        (10, 20)
        >>> point.as_xy_float_tuple()
        (10.0, 20.0)

        ```
    ÚfloatÚxÚyc                óV   — t        | j                  «      t        | j                  «      fS )zw
        Returns the point as a tuple of integers.

        Returns:
            The point as (x, y) integers.
        )Úintr(   r)   ©Úselfs    r   Úas_xy_int_tuplezPoint.as_xy_int_tuple5   s   € ô �4—6‘6‹{œC §¡›KÐ'Ð'r   c                ó2   — | j                   | j                  fS )zs
        Returns the point as a tuple of floats.

        Returns:
            The point as (x, y) floats.
        ©r(   r)   r,   s    r   Úas_xy_float_tuplezPoint.as_xy_float_tuple>   s   € ð �v‰v�t—v‘vˆ~Ðr   N)r   ztuple[int, int])r   ztuple[float, float])r   r    r!   r"   Ú__annotations__r.   r1   r$   r   r   r&   r&      s   … ñð& ƒHØƒHó(ôr   r&   c                  óR   — e Zd ZU dZded<   ded<   ed	d„«       Zed
d„«       Zdd„Zy)ÚVectora  
    Represents a vector in 2D space, defined by a start and an end point.

    Attributes:
        start: The starting point of the vector.
        end: The end point of the vector.

    Example:
        ```pycon
        >>> from supervision.geometry.core import Point, Vector
        >>> start_point = Point(x=0.0, y=0.0)
        >>> end_point = Point(x=3.0, y=4.0)
        >>> vector = Vector(start=start_point, end=end_point)
        >>> vector.magnitude
        5.0
        >>> vector.center
        Point(x=1.5, y=2.0)

        ```
    r&   ÚstartÚendc                óÞ   — | j                   j                  | j                  j                  z
  }| j                   j                  | j                  j                  z
  }t	        |dz  |dz  z   «      S )z|
        Calculate the magnitude (length) of the vector.

        Returns:
            The magnitude of the vector.
        é   )r6   r(   r5   r)   r   )r-   ÚdxÚdys      r   Ú	magnitudezVector.magnitudeb   sO   € ð �X‰X�Z‰Z˜$Ÿ*™*Ÿ,™,Ñ&ˆØ�X‰X�Z‰Z˜$Ÿ*™*Ÿ,™,Ñ&ˆÜ�B˜‘E˜B ™E‘MÓ"Ð"r   c                óÔ   — t        | j                  j                  | j                  j                  z   dz  | j                  j                  | j                  j                  z   dz  ¬«      S )zy
        Calculate the center point of the vector.

        Returns:
            The center point of the vector.
        r8   r0   )r&   r5   r(   r6   r)   r,   s    r   ÚcenterzVector.centern   sK   € ô Ø�z‰z�|‰|˜dŸh™hŸj™jÑ(¨AÑ-Ø�z‰z�|‰|˜dŸh™hŸj™jÑ(¨AÑ-ô
ð 	
r   c                óX  — | j                   j                  | j                  j                  z
  }| j                   j                  | j                  j                  z
  }|j                  | j                  j                  z
  }|j                  | j                  j                  z
  }||z  ||z  z
  S )ah  
        Calculate the 2D cross product (also known as the vector product or outer
        product) of the vector and a point, treated as vectors in 2D space.

        Args:
            point: The point to be evaluated, treated as the endpoint of a
                vector originating from the 'start' of the main vector.

        Returns:
            The scalar value of the cross product. It is positive if 'point'
                lies to the left of the vector (when moving from 'start' to 'end'),
                negative if it lies to the right, and 0 if it is collinear with the
                vector.
        )r6   r(   r5   r)   )r-   ÚpointÚ	dx_vectorÚ	dy_vectorÚdx_pointÚdy_points         r   Úcross_productzVector.cross_product{   sy   € ð —H‘H—J‘J §¡§¡Ñ-ˆ	Ø—H‘H—J‘J §¡§¡Ñ-ˆ	Ø—7‘7˜TŸZ™ZŸ\™\Ñ)ˆØ—7‘7˜TŸZ™ZŸ\™\Ñ)ˆØ˜HÑ$¨°XÑ)=Ñ>Ð>r   N)r   r'   ©r   r&   )r?   r&   r   r'   )	r   r    r!   r"   r2   Úpropertyr;   r=   rD   r$   r   r   r4   r4   H   s>   … ñð* ƒLØ	ƒJàò	#ó ð	#ð ò

ó ð

ô?r   r4   c                  ó€   — e Zd ZU dZded<   ded<   ded<   ded<   edd„«       Zedd„«       Zedd	„«       Z	dd
„Z
dd„Zy)ÚRectav  
    Represents a rectangle in 2D space.

    Attributes:
        x: The x-coordinate of the top-left corner of the rectangle.
        y: The y-coordinate of the top-left corner of the rectangle.
        width: The width of the rectangle.
        height: The height of the rectangle.

    Example:
        ```pycon
        >>> from supervision.geometry.core import Rect
        >>> rect = Rect(x=10.0, y=20.0, width=30.0, height=40.0)
        >>> rect.top_left
        Point(x=10.0, y=20.0)
        >>> rect.bottom_right
        Point(x=40.0, y=60.0)
        >>> rect.as_xyxy_int_tuple()
        (10, 20, 40, 60)

        ```
    r'   r(   r)   ÚwidthÚheightc                ó4   — |\  }}}} | ||||z
  ||z
  ¬«      S )N©r(   r)   rI   rJ   r$   )r   ÚxyxyÚx1Úy1Úx2Úy2s         r   Ú	from_xyxyzRect.from_xyxy¯   s(   € à‰ˆˆB��BÙ�R˜2 R¨"¡W°R¸"±WÔ=Ð=r   c                óD   — t        | j                  | j                  ¬«      S ©Nr0   )r&   r(   r)   r,   s    r   Útop_leftzRect.top_left´   s   € ä�t—v‘v §¡Ô(Ð(r   c                óx   — t        | j                  | j                  z   | j                  | j                  z   ¬«      S rT   )r&   r(   rI   r)   rJ   r,   s    r   Úbottom_rightzRect.bottom_right¸   s)   € ä�t—v‘v §
¡
Ñ*¨d¯f©f°t·{±{Ñ.BÔCÐCr   c                ó”   — t        | j                  |z
  | j                  |z
  | j                  d|z  z   | j                  d|z  z   ¬«      S )Nr8   rL   )rH   r(   r)   rI   rJ   )r-   Úpaddings     r   ÚpadzRect.pad¼   sG   € ÜØ�f‰f�wÑØ�f‰f�wÑØ—*‘*˜q 7™{Ñ*Ø—;‘;  W¡Ñ,ô	
ð 	
r   c                óÚ   — t        | j                  «      t        | j                  «      t        | j                  | j                  z   «      t        | j                  | j                  z   «      fS r   )r+   r(   r)   rI   rJ   r,   s    r   Úas_xyxy_int_tuplezRect.as_xyxy_int_tupleÄ   sL   € ä�—‘‹KÜ�—‘‹KÜ�—‘˜Ÿ™Ñ#Ó$Ü�—‘˜Ÿ™Ñ$Ó%ð	
ð 	
r   N)rM   z!tuple[float, float, float, float]r   rH   rE   )rY   r+   r   rH   )r   ztuple[int, int, int, int])r   r    r!   r"   r2   r#   rR   rF   rU   rW   rZ   r\   r$   r   r   rH   rH   ‘   sc   … ñð. ƒHØƒHØƒLØƒMàò>ó ð>ð ò)ó ð)ð òDó ðDó
ô
r   rH   N)Ú
__future__r   Údataclassesr   Úenumr   Úmathr   r   r&   r4   rH   r$   r   r   ú<module>ra      sm   ðÝ "å !Ý Ý ô1ˆtô 1ð* ÷'ð 'ó ð'ðT ÷E?ð E?ó ðE?ðP ÷8
ð 8
ó ñ8
r   