U
    j<~gF                     @  s   d dl mZ d dlZddlmZ ddlmZmZ ddlmZ	 ddlm
Z ddlmZmZ d	d
dddddddddddZd	d
dddddddddddZdddddddddZ
dddddddddZdS )    )annotationsN   )__version__)	clockwisecolinear)concave_hull_indexes)convex_hull_indexes)orientationwgs84_to_east_northg       @g        F	concavitylength_thresholdr   is_wgs84znp.ndarray | list | tuplefloatznp.ndarray | Noneboolpointsr   r   r   r   c                C  sP   t j| t jd} | ddddf } |r0t| } |dkr@t| }t| |||dS )af  
    Get concave hull indexes of points.

    -   `points` is an array of [x, y, [z]] points (can be numpy.ndarray, list, or tuple).
    -   `concavity` is a relative measure of concavity. 1 results in a relatively
        detailed shape, Infinity results in a convex hull. You can use values lower
        than 1, but they can produce pretty crazy shapes.
    -   `length_threshold`: when a segment length is under this threshold, it stops
        being considered for further detalization. Higher values result in simpler
        shapes.

    See original document here: https://github.com/mapbox/concaveman
    ZdtypeN   )r   r   r   )npasarrayfloat64r
   convex_hull_indexes_implconcave_hull_indexes_implr    r   X/home/ankuromar296_gmail_com/.local/lib/python3.8/site-packages/concave_hull/__init__.pyr      s    r   z
np.ndarrayc                  s8   t  ||||d}t tjr& | S  fdd|D S )Nr   c                   s   g | ]} | qS r   r   .0ir   r   r   
<listcomp>A   s     z concave_hull.<locals>.<listcomp>)r   
isinstancer   ndarray)r   r   r   r   r   indexesr   r   r   concave_hull/   s    	

r$   include_colinear
order_onlyr   r&   r'   c                C  s.   t j| t jd} t| d d d df ||dS )Nr   r   r%   )r   r   r   r   r(   r   r   r   r   E   s    r   c                  s4   t  ||d}t tjr" | S  fdd|D S )Nr%   c                   s   g | ]} | qS r   r   r   r   r   r   r    a   s     zconvex_hull.<locals>.<listcomp>)r   r!   r   r"   )r   r&   r'   r#   r   r   r   convex_hullS   s    

r)   )
__future__r   numpyr   Z_corer   r   r   r   r   r   r   r	   r
   r$   r)   r   r   r   r   <module>   s,   &