§
    >²¸j  ã                  óÐ   — 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dS )é    )Úannotations)Ú	dataclass)ÚEnum)Úsqrtc                  óR   — 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dS )Ú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_MASSÚreturnú	list[str]c                ó   — d„ | D ¦   «         S )z5Return all position values in their definition order.c                ó   — g | ]	}|j         ‘Œ
S © )Úvalue)Ú.0Úpositions     úi/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/supervision/geometry/core.pyú
<listcomp>z!Position.list.<locals>.<listcomp>   s   € Ð3Ð3Ð3 8�”Ð3Ð3Ð3ó    r   )Úclss    r   ÚlistzPosition.list   s   € ð 4Ð3¨sÐ3Ñ3Ô3Ð3r   N)r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   r
   r   r   r   r   r   r   r   r   Úclassmethodr   r   r   r   r   r      sp   € € € € € ðð ð €FØ€KØ!€LØ€JØ€HØ€IØ€KØ#€MØ!€LØ%€Nàð4ð 4ð 4ñ „[ð4ð 4ð 4r   r   c                  ó8   — e Zd ZU dZded<   ded<   dd„Zdd	„Zd
S )Ú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Úyr   útuple[int, int]c                óR   — 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_tuple6   s   € õ �4”6‰{Œ{�C ¤™KœKÐ'Ð'r   útuple[float, float]c                ó   — | 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�t”vˆ~Ðr   N)r   r*   )r   r0   )r    r!   r"   r#   Ú__annotations__r/   r3   r   r   r   r&   r&      s\   € € € € € € ðð ð& €H€H�HØ€H€H�Hð(ð (ð (ð (ðð ð ð ð ð r   r&   c                  ó`   — e Zd ZU dZded<   ded<   edd„¦   «         Zedd„¦   «         Zdd
„ZdS )Ú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Úendr   r'   c                ó–   — | 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.
        é   )r8   r(   r7   r)   r   )r.   ÚdxÚdys      r   Ú	magnitudezVector.magnitudec   sB   € ð ŒXŒZ˜$œ*œ,Ñ&ˆØŒXŒ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.
        r:   r2   )r&   r7   r(   r8   r)   r-   s    r   ÚcenterzVector.centero   sE   € õ ØŒzŒ|˜dœhœjÑ(¨AÑ-ØŒzŒ|˜dœhœjÑ(¨AÑ-ð
ñ 
ô 
ð 	
r   Úpointc                óÌ   — | 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.
        )r8   r(   r7   r)   )r.   r@   Ú	dx_vectorÚ	dy_vectorÚdx_pointÚdy_points         r   Úcross_productzVector.cross_product|   s]   € ð ”H”J ¤¤Ñ-ˆ	Ø”H”J ¤¤Ñ-ˆ	Ø”7˜TœZœ\Ñ)ˆØ”7˜TœZœ\Ñ)ˆØ˜HÑ$¨°XÑ)=Ñ>Ð>r   N)r   r'   ©r   r&   )r@   r&   r   r'   )	r    r!   r"   r#   r4   Úpropertyr=   r?   rF   r   r   r   r6   r6   I   s†   € € € € € € ðð ð* €L€L�LØ€J€J�Jàð	#ð 	#ð 	#ñ „Xð	#ð ð

ð 

ð 

ñ „Xð

ð?ð ?ð ?ð ?ð ?ð ?r   r6   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dS )Ú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ÚheightÚxyxyú!tuple[float, float, float, float]r   c                ó:   — |\  }}}} | ||||z
  ||z
  ¬¦  «        S )zCCreate a rectangle from `(x_min, y_min, x_max, y_max)` coordinates.©r(   r)   rK   rL   r   )r   rM   Úx1Úy1Úx2Úy2s         r   Ú	from_xyxyzRect.from_xyxy°   s2   € ð ‰ˆˆB��BØˆs�R˜2 R¨"¡W°R¸"±WÐ=Ñ=Ô=Ð=r   r&   c                ó8   — t          | j        | j        ¬¦  «        S )z(Return the top-left corner as a `Point`.r2   )r&   r(   r)   r-   s    r   Útop_leftzRect.top_left¶   s   € õ �t”v ¤Ð(Ñ(Ô(Ð(r   c                óX   — t          | j        | j        z   | j        | j        z   ¬¦  «        S )z,Return the bottom-right corner as a `Point`.r2   )r&   r(   rK   r)   rL   r-   s    r   Úbottom_rightzRect.bottom_right»   s)   € õ �t”v ¤
Ñ*¨d¬f°t´{Ñ.BÐCÑCÔCÐCr   Úpaddingr,   c                ót   — t          | j        |z
  | j        |z
  | j        d|z  z   | j        d|z  z   ¬¦  «        S )z>Return a rectangle expanded by `padding` pixels on every side.r:   rP   )rJ   r(   r)   rK   rL   )r.   rZ   s     r   ÚpadzRect.padÀ   sI   € åØŒf�wÑØŒf�wÑØ”*˜q 7™{Ñ*Ø”;  W¡Ñ,ð	
ñ 
ô 
ð 	
r   útuple[int, int, int, int]c                ó¾   — t          | j        ¦  «        t          | j        ¦  «        t          | j        | j        z   ¦  «        t          | j        | j        z   ¦  «        fS )z>Return `(x_min, y_min, x_max, y_max)` coordinates as integers.)r,   r(   r)   rK   rL   r-   s    r   Úas_xyxy_int_tuplezRect.as_xyxy_int_tupleÉ   sL   € õ �”‰KŒKÝ�”‰KŒKÝ�”˜œÑ#Ñ$Ô$Ý�”˜œÑ$Ñ%Ô%ð	
ð 	
r   N)rM   rN   r   rJ   rG   )rZ   r,   r   rJ   )r   r]   )r    r!   r"   r#   r4   r$   rU   rH   rW   rY   r\   r_   r   r   r   rJ   rJ   ’   sÐ   € € € € € € ðð ð. €H€H�HØ€H€H�HØ€L€L�LØ€M€M�Màð>ð >ð >ñ „[ð>ð
 ð)ð )ð )ñ „Xð)ð ðDð Dð Dñ „XðDð
ð 
ð 
ð 
ð
ð 
ð 
ð 
ð 
ð 
r   rJ   N)Ú
__future__r   Údataclassesr   Úenumr   Úmathr   r   r&   r6   rJ   r   r   r   ú<module>rd      s'  ðØ "Ð "Ð "Ð "Ð "Ð "à !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ð4ð 4ð 4ð 4ð 4ˆtñ 4ô 4ð 4ð, ð'ð 'ð 'ð 'ð 'ñ 'ô 'ñ „ð'ðT ðE?ð E?ð E?ð E?ð E?ñ E?ô E?ñ „ðE?ðP ð=
ð =
ð =
ð =
ð =
ñ =
ô =
ñ „ð=
ð =
ð =
r   