o
    Jf                     @   s<   d Z ddlZddlZddlmZ dd Zdd Zdd	 ZdS )
zBProvides multi-point element-wise operations such as ``contains``.    N)PreparedGeometryc                 C   sf   t | t |} }| j|jkrtd| jt jkr!| t j} |jt jkr-|t j}t| |S )Nz"X and Y shapes must be equivalent.)	np
asanyarrayshape
ValueErrordtypefloat64astypeshapelypoints)xy r   g/home/deployuser/azure_apps/autowriter/venv/lib/python3.10/site-packages/shapely/vectorized/__init__.py_construct_points	   s   r   c                 C   s(   t | tr| j} t|  t| ||S )an  
    Vectorized (element-wise) version of `contains` which checks whether
    multiple points are contained by a single geometry.

    Parameters
    ----------
    geometry : PreparedGeometry or subclass of BaseGeometry
        The geometry which is to be checked to see whether each point is
        contained within. The geometry will be "prepared" if it is not already
        a PreparedGeometry instance.
    x : array
        The x coordinates of the points to check.
    y : array
        The y coordinates of the points to check.

    Returns
    -------
    Mask of points contained by the given `geometry`.

    )
isinstancer   contextr
   preparecontains_xy)geometryr   r   r   r   r   contains   s   

r   c                 C   s.   t | tr| j} | j}t| t|||S )a  
    Vectorized (element-wise) version of `touches` which checks whether
    multiple points touch the exterior of a single geometry.

    Parameters
    ----------
    geometry : PreparedGeometry or subclass of BaseGeometry
        The geometry which is to be checked to see whether each point is
        contained within. The geometry will be "prepared" if it is not already
        a PreparedGeometry instance.
    x : array
        The x coordinates of the points to check.
    y : array
        The y coordinates of the points to check.

    Returns
    -------
    Mask of points which touch the exterior of the given `geometry`.

    )r   r   r   boundaryr
   r   intersects_xy)r   r   r   r   r   r   r   touches1   s
   

r   )	__doc__numpyr   r
   shapely.preparedr   r   r   r   r   r   r   r   <module>   s    