B
    wzf                 @   s  d dl mZmZmZ d dl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eejeef eeejedddZ
dd	dd
deejeef eeejedddZd
d
deejeef eedddZd
d
deejeef eedddZdS )    )ListTupleUnionN)__version__)	clockwisecolinear)concave_hull_indexes)convex_hull_indexes)orientationwgs84_to_east_northg       @g        F)	concavitylength_thresholdr	   is_wgs84)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
    )dtypeN   )r   r   r	   )npasarrayfloat64r   convex_hull_indexes_implconcave_hull_indexes_impl)r   r   r   r	   r    r   X/home/ankuromar296_gmail_com/.local/lib/python3.7/site-packages/concave_hull/__init__.pyr      s    r   c               s8   t  ||||d}t tjr& | S  fdd|D S )N)r   r   r	   r   c                s   g | ]} | qS r   r   ).0i)r   r   r   
<listcomp>C   s    z concave_hull.<locals>.<listcomp>)r   
isinstancer   ndarray)r   r   r   r	   r   indexesr   )r   r   concave_hull1   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 )N)r   r   )r    r!   )r   r   r   r   )r   r    r!   r   r   r   r	   G   s
    r	   c               s4   t  ||d}t tjr" | S  fdd|D S )N)r    r!   c                s   g | ]} | qS r   r   )r   r   )r   r   r   r   c   s    zconvex_hull.<locals>.<listcomp>)r	   r   r   r   )r   r    r!   r   r   )r   r   convex_hullU   s    r"   )typingr   r   r   numpyr   Zpybind11_concave_hullr   r   r   r   r   r	   r   r
   r   r   floatboolr   r"   r   r   r   r   <module>   s&   * *$