Skip to contents

nearest neighbour angles and distances

Usage

nnangle(x, from, to)

Arguments

x

Matrix of coordinates, n rows and d columns

Value

The values in 2d are (azimuth, distance). The values in 3d are physical coordinate system (azimuth, inclination, distance)

Details

If 2d, returns the angle in [-pi,pi]. In 3d also the angle from xy-plane in [0,pi]

Examples

x <- matrix(runif(200), ncol = 2)
nn <- nnangle(x)
summary(nn)
#> Angle [0, 2pi], observed [0.07293,6.17581]
#> Distance, observed [0.00418,0.13651]
#> 
#> Kolmogorov-Smirnov test against uniformity:
#> D= 0.04642534  p= 0.9823627