ConvexHull

Javascript implementation of Andrew's Monotone Chain convex hull algorithm. Useful for Google Maps work.

Stars
52

h1. Javascript Convex Hull

Javascript implementation of Andrew's Monotone Chain algorithm for calculating a 2D convex hull. This can work directly with the Google Maps API's GPoints.

The algorithm is described and a C++ implementation can be found at http://softsurfer.com/Archive/algorithm_0109/algorithm_0109.htm

A sample of this algorithm implemented with Google Maps can be found at http://www.geocodezip.com/map-markers_ConvexHull_Polygon.asp

  • Please note the algorithm used in the Google Maps' implementation contains a bug that his been fixed in this repository.

h2. Usage

h3. Changes

  • 1.0.1: Fixed bug that was causing the algorithm to double back onto itself.