
    ը	f                         d Z ddlZd Zd Zy)a  
@package iscatt.utils

@brief Misc utilities for iscatt

(C) 2020 by the GRASS Development Team

This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.

@author Nicklas Larsson <n_larsson yahoo com>
    Nc                 ^    | |z
  }t        j                  t        j                  ||            S )z1
    Return the distance between two points.
    )npsqrtdot)xyds      -/usr/lib/grass83/gui/wxpython/iscatt/utils.pydistr      s&     	
AA77266!Q<      c                    t        j                  | t              } t        j                  |t              }t        j                  |t              }||z
  }| |z
  }t        j                  ||      }|dk  rt	        | |      S t        j                  ||      }||k  rt	        | |      S ||z  }|||z  z   }t	        | |      S )z
    Get the distance of a point to a segment.

      *p*, *s0*, *s1* are *xy* sequences

    This algorithm from
    http://geomalgorithms.com/a02-_lines.html
    r   )r   asarrayfloatr   r   )	ps0s1vwc1c2bpbs	            r
   dist_point_to_segmentr      s     	

1eA	B	B	B	B
RA	BA	1B	QwAr{	1B	RxAr{
RA	a!eB2;r   )__doc__numpyr   r   r    r   r
   <module>r      s    
!r   