## ConcaveHull.jl

Julia package for calculating 2D concave/convex hulls
Author lstagner
Popularity
14 Stars
Updated Last
6 Months Ago
Started In
January 2017

# ConcaveHull This package computes the concave/convex hull of a set of points using a nearest neighbours algorithm.

 Moreira, Adriano, and Maribel Yasmina Santos. "Concave hull: A k-nearest neighbours approach for the computation of the region occupied by a set of points." (2007).

## Usage

```Pkg.add("ConcaveHull") # Add package
using ConcaveHull
using Plots

points = [[th, -sin(th)] .+ (0.4*rand(2) .- 0.2) for th in range(0, stop=2pi, length=5000)];
x = [p for p in points];
y = [p for p in points];

hull = concave_hull(points)
hull_area = area(hull)

scatter(x,y,ms=1,label="",axis=false,grid=false,markerstrokewidth=0.0)
plot!(hull)
annotate!(pi/2,0.5,"K = \$(hull.k)")
annotate!(pi/2,0.25,"Area \$(round(hull_area, digits=3))")``` ## Smoothness

The smoothness of the concave hull can be adjusted by increasing the number of neighbours used

```hull = concave_hull(points,100) # Use 100 neighbours
hull_area = area(hull)

scatter(x,y,ms=1,label="",axis=false,grid=false,markerstrokewidth=0.0)
plot!(hull)
annotate!(pi/2,0.5,"K = \$(hull.k)")
annotate!(pi/2,0.25,"Area \$(round(hull_area, digits=3))")``` ### Used By Packages

No packages found.