§
    eÎj1  ã                   óÆ   — d Z ddlZddlZddlmZ ddlmZ g d¢Z edge¬¦  «        	 dd	d
œde	dz  de	fd„¦   «         Z
d„ Z eddge¬¦  «        dddœd„¦   «         Zd„ ZdS )z6Methods that operate on the coordinates of geometries.é    N)Úlib)Údeprecate_positional)Úcount_coordinatesÚget_coordinatesÚset_coordinatesÚ	transformÚ	include_z)ÚcategoryFT)Úinterleavedr   c                óf  — t          j        | t           j        ¬¦  «        }|€ct          j        |¦  «        }t          j        |¦  «        }t          ||         |d|¬¦  «        ||<   t          ||          |d|¬¦  «        || <   nòd}t          j        |||d¦  «        }|r ||¦  «        }	n-t          j	         ||j
        Ž t           j        ¬¦  «        j
        }	t          |	t           j        ¦  «        r|	j        dk    rt          d¦  «        ‚|	j        t           j        k    rt          d|	j        › d	�¦  «        ‚|	j        |j        k    rt          d
|	j        › d	�¦  «        ‚t          j        ||	¦  «        }|j        dk    r.t          | t           j        ¦  «        s|                     ¦   «         S |S )a   Apply a function to the coordinates of a geometry.

    With the default of ``include_z=False``, all returned geometries will be
    two-dimensional; the third dimension will be discarded, if present.
    When specifying ``include_z=True``, the returned geometries preserve
    the dimensionality of the respective input geometries.

    Parameters
    ----------
    geometry : Geometry or array_like
        Geometry or geometries to transform.
    transformation : function
        A function that transforms a (N, 2) or (N, 3) ndarray of float64 to
        another (N, 2) or (N, 3) ndarray of float64.
        The function may not change N.
    include_z : bool, optional, default False
        If False, always return 2D geometries.
        If True, the data being passed to the
        transformation function will include the third dimension
        (if a geometry has no third dimension, the z-coordinates
        will be NaN). If None, will infer the dimensionality per
        input geometry using ``has_z``, which may result in 2 calls to
        the transformation function. Note that this inference
        can be unreliable with empty geometries or NaN coordinates: for a
        guaranteed result, it is recommended to specify ``include_z`` explicitly.
    interleaved : bool, default True
        If set to False, the transformation function should accept 2 or 3 separate
        one-dimensional arrays (x, y and optional z) instead of a single
        two-dimensional array.

        .. versionadded:: 2.1.0

    Notes
    -----

    .. deprecated:: 2.1.0
        A deprecation warning is shown if ``include_z`` is specified as a
        positional argument. This will need to be specified as a keyword
        argument in a future release.

    See Also
    --------
    has_z

    Examples
    --------
    >>> import shapely
    >>> from shapely import LineString, Point
    >>> shapely.transform(Point(0, 0), lambda x: x + 1)
    <POINT (1 1)>
    >>> shapely.transform(LineString([(2, 2), (4, 4)]), lambda x: x * [2, 3])
    <LINESTRING (4 6, 8 12)>
    >>> shapely.transform(None, lambda x: x) is None
    True
    >>> shapely.transform([Point(0, 0), None], lambda x: x).tolist()
    [<POINT (0 0)>, None]

    The presence of a third dimension can be automatically detected, or
    controlled explicitly:

    >>> shapely.transform(Point(0, 0, 0), lambda x: x + 1)
    <POINT (1 1)>
    >>> shapely.transform(Point(0, 0, 0), lambda x: x + 1, include_z=True)
    <POINT Z (1 1 1)>
    >>> shapely.transform(Point(0, 0, 0), lambda x: x + 1, include_z=None)
    <POINT Z (1 1 1)>

    With interleaved=False, the call signature of the transformation is different:

    >>> shapely.transform(LineString([(1, 2), (3, 4)]), lambda x, y: (x + 1, y), interleaved=False)
    <LINESTRING (2 2, 4 4)>

    Or with a z coordinate:

    >>> shapely.transform(Point(0, 0, 0), lambda x, y, z: (x + 1, y, z + 2), interleaved=False, include_z=True)
    <POINT Z (1 0 2)>

    Using pyproj >= 2.1, the following example will reproject Shapely geometries
    from EPSG 4326 to EPSG 32618:

    >>> from pyproj import Transformer
    >>> transformer = Transformer.from_crs(4326, 32618, always_xy=True)
    >>> shapely.transform(Point(-75, 50), transformer.transform, interleaved=False)
    <POINT (500000 5538630.703)>

    ©ÚdtypeNT)r	   r   Fé   zHThe provided transformation did not return a two-dimensional numpy arrayzHThe provided transformation returned an array with an unexpected dtype (ú)zHThe provided transformation returned an array with an unexpected shape (r   )ÚnpÚarrayÚobject_ÚshapelyÚhas_zÚ
empty_liker   r   r   ÚasarrayÚTÚfloat64Ú
isinstanceÚndarrayÚndimÚ
ValueErrorr   Úshaper   Úitem)
ÚgeometryÚtransformationr	   r   Úgeometry_arrr   ÚresultÚ	include_mÚcoordinatesÚnew_coordinatess
             úc/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/shapely/coordinates.pyr   r      sõ  € õ@ ”8˜H­B¬JÐ7Ñ7Ô7€LØÐÝ”˜lÑ+Ô+ˆÝ”˜|Ñ,Ô,ˆÝ!Ø˜Ô ¸4È[ð
ñ 
ô 
ˆˆu‰õ #Ø˜%˜Ô ØØØ#ð	
ñ 
ô 
ˆ�ˆv‰ˆð ˆ	ÝÔ)¨,¸	À9ÈeÑTÔTˆØð 	Ø,˜n¨[Ñ9Ô9ˆOˆOå œjØ� ¤Ð.µb´jðñ ô äð õ ˜/­2¬:Ñ6Ô6ð 	¸/Ô:NÐRSÒ:SÐ:SÝðñô ð ð Ô ¥B¤JÒ.Ð.Ýð3Ø)Ô/ð3ð 3ð 3ñô ð ð Ô  KÔ$5Ò5Ð5åð3Ø)Ô/ð3ð 3ð 3ñô ð õ Ô$ \°?ÑCÔCˆØ„{�aÒÐ¥
¨8µR´ZÑ @Ô @ÐØ�{Š{‰}Œ}ÐØ€Mó    c                 óf   — t          j        t          j        | t          j        ¬¦  «        ¦  «        S )a  Count the number of coordinate pairs in a geometry array.

    Parameters
    ----------
    geometry : Geometry or array_like
        Geometry or geometries to count the coordinates of.

    Examples
    --------
    >>> import shapely
    >>> from shapely import LineString, Point
    >>> shapely.count_coordinates(Point(0, 0))
    1
    >>> shapely.count_coordinates(LineString([(2, 2), (4, 2)]))
    2
    >>> shapely.count_coordinates(None)
    0
    >>> shapely.count_coordinates([Point(0, 0), None])
    1

    r   )r   r   r   r   r   )r    s    r'   r   r   £   s&   € õ, Ô ¥¤¨H½B¼JÐ!GÑ!GÔ!GÑHÔHÐHr(   Úreturn_index)r$   c                ól   — t          j        t          j        | t          j        ¬¦  «        |||¦  «        S )a9
  Get coordinates from a geometry array as an array of floats.

    The shape of the returned array is (N, 2), with N being the number of
    coordinate pairs. The shape of the data may also be (N, 3) or (N, 4),
    depending on ``include_z`` and ``include_m`` options.

    Parameters
    ----------
    geometry : Geometry or array_like
        Geometry or geometries to get the coordinates of.
    include_z, include_m : bool, default False
        If both are False, return XY (2D) geometries.
        If both are True, return XYZM (4D) geometries.
        If either are True, return XYZ or XYM (3D) geometries.
        If a geometry has no Z or M dimension, extra coordinate data will be NaN.

        .. versionadded:: 2.1.0
            The ``include_m`` parameter was added to support XYM (3D) and
            XYZM (4D) geometries available with GEOS 3.12.0 or later.
            With older GEOS versions, M dimension coordinates will be NaN.

    return_index : bool, default False
        If True, also return the index of each returned geometry as a separate
        ndarray of integers. For multidimensional arrays, this indexes into the
        flattened array (in C contiguous order).

    Notes
    -----

    .. deprecated:: 2.1.0
        A deprecation warning is shown if ``include_z`` or ``return_index`` are
        specified as positional arguments. In a future release, these will
        need to be specified as keyword arguments.

    Examples
    --------
    >>> import shapely
    >>> from shapely import LineString, Point
    >>> shapely.get_coordinates(Point(1, 2)).tolist()
    [[1.0, 2.0]]
    >>> shapely.get_coordinates(LineString([(2, 2), (4, 4)])).tolist()
    [[2.0, 2.0], [4.0, 4.0]]
    >>> shapely.get_coordinates(None)
    array([], shape=(0, 2), dtype=float64)

    By default the third dimension is ignored:

    >>> shapely.get_coordinates(Point(1, 2, 3)).tolist()
    [[1.0, 2.0]]
    >>> shapely.get_coordinates(Point(1, 2, 3), include_z=True).tolist()
    [[1.0, 2.0, 3.0]]

    If geometries don't have Z or M dimension, these values will be NaN:

    >>> pt = Point(1, 2)
    >>> shapely.get_coordinates(pt, include_z=True).tolist()
    [[1.0, 2.0, nan]]
    >>> shapely.get_coordinates(pt, include_z=True, include_m=True).tolist()
    [[1.0, 2.0, nan, nan]]

    When ``return_index=True``, indexes are returned also:

    >>> geometries = [LineString([(2, 2), (4, 4)]), Point(0, 0)]
    >>> coordinates, index = shapely.get_coordinates(geometries, return_index=True)
    >>> coordinates.tolist(), index.tolist()
    ([[2.0, 2.0], [4.0, 4.0], [0.0, 0.0]], [0, 0, 1])

    r   )r   r   r   r   r   )r    r	   r*   r$   s       r'   r   r   Å   s4   € õL ÔÝ
Œ
�8¥2¤:Ð.Ñ.Ô.°	¸9Àlñô ð r(   c                 óD  — t          j        | t           j        ¬¦  «        }t          j        t          j        |¦  «        ¦  «                             t           j        ¦  «        }|j        dk    rt          d|j        › d�¦  «        ‚t          j	        |¦  «        }|j
        d         |k    s|j
        d         dvrt          d|j
        › �¦  «        ‚t          j        ||¦  «         |j        dk    r.t          | t           j        ¦  «        s|                     ¦   «         S |S )	a$  Adapts the coordinates of a geometry array in-place.

    If the coordinates array has shape (N, 2), all returned geometries
    will be two-dimensional, and the third dimension will be discarded,
    if present. If the coordinates array has shape (N, 3), the returned
    geometries preserve the dimensionality of the input geometries.

    .. warning::

        The geometry array is modified in-place! If you do not want to
        modify the original array, you can do
        ``set_coordinates(arr.copy(), newcoords)``.

    Parameters
    ----------
    geometry : Geometry or array_like
        Geometry or geometries to set the coordinates of.
    coordinates: array_like
        An array of coordinates to set.

    See Also
    --------
    transform : Returns a copy of a geometry array with a function applied to its
        coordinates.

    Examples
    --------
    >>> import shapely
    >>> from shapely import LineString, Point
    >>> shapely.set_coordinates(Point(0, 0), [[1, 1]])
    <POINT (1 1)>
    >>> shapely.set_coordinates(
    ...     [Point(0, 0), LineString([(0, 0), (0, 0)])],
    ...     [[1, 2], [3, 4], [5, 6]]
    ... ).tolist()
    [<POINT (1 2)>, <LINESTRING (3 4, 5 6)>]
    >>> shapely.set_coordinates([None, Point(0, 0)], [[1, 2]]).tolist()
    [None, <POINT (1 2)>]

    Third dimension of input geometry is discarded if coordinates array does
    not include one:

    >>> shapely.set_coordinates(Point(0, 0, 0), [[1, 1]])
    <POINT (1 1)>
    >>> shapely.set_coordinates(Point(0, 0, 0), [[1, 1, 1]])
    <POINT Z (1 1 1)>

    r   r   z5The coordinate array should have dimension of 2 (has r   r   é   >   r   é   z*The coordinate array has an invalid shape )r   r   r   Ú
atleast_2dÚastyper   r   r   r   r   r   r   r   r   r   )r    r%   r"   Ún_coordss       r'   r   r     s  € õb ”:˜h­b¬jÐ9Ñ9Ô9€LÝ”-¥¤
¨;Ñ 7Ô 7Ñ8Ô8×?Ò?ÅÄ
ÑKÔK€KØÔ˜1ÒÐÝØWÀKÔDTÐWÐWÐWñ
ô 
ð 	
õ Ô$ \Ñ2Ô2€HØÔ˜!Ô Ò(Ð(¨kÔ.?ÀÔ.BÈ&Ð.PÐ.PÝØL¸Ô9JÐLÐLñ
ô 
ð 	
õ Ô˜ kÑ2Ô2Ð2ØÔ˜AÒÐ¥j°½2¼:Ñ&FÔ&FÐØ× Ò Ñ"Ô"Ð"ØÐr(   )F)FF)Ú__doc__Únumpyr   r   r   Úshapely.decoratorsr   Ú__all__ÚDeprecationWarningÚboolr   r   r   r   © r(   r'   ú<module>r9      s7  ðØ <Ð <à Ð Ð Ð à €€€Ø Ð Ð Ð Ð Ð Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3à
RÐ
RÐ
R€ð Ð�{�mÐ.@ÐAÑAÔAð #ðJð
 ðJð Jð Jð �d‰{ðJð
 ðJð Jð Jñ BÔAðJðZIð Ið IðD Ð�{ NÐ3Ð>PÐQÑQÔQðGÐPUð Gð Gð Gð Gñ RÔQðGðT?ð ?ð ?ð ?ð ?r(   