Skip to content

USACE/concavehull

Repository files navigation

Concave Hull

Usage

The algorithms accepts a flat array of coordinates (even positions are latitudes and odd positions are longitudes)

coordinates = []float64{x0, y0, x1, y1, ...}
concaveHull := ConcaveHull.Compute(ConcaveHull.FlatPoints(coordinates))

Algorithm

The algorithm starts from a convex hull of the given points and find points close to the edges to build the final polygon. Finally Douglas Peucker is applied to simplify the polygon. It builds a Concave Hull around the points but it is not an alpha shape.

Performance

The following benchmark was run on example 4 from this website. It took 0.19s to build the concave hull. The benchmark was done in a i5 2.50GHz 8Gb of RAM running on Linux

BenchmarkCompute_ConcaveHullSmall/CPU#03/examples/examples/4-camps-drift.txt-4       	      20	 193270383 ns/op

Concave hull of a network

To run the benchmarks run go generate, this will download all the necessary files

Installation

This project uses dep to handle dependencies.

Acknowledgments

The algorithm is based on SnapHull from Pimin Konstantin Kefaloukos, which in turn is based on the algorithm for st_concavehull from Postgis 2.0. Thanks to acraig for providing the data set of the picture

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published