- Object
-
- MonotoneChain
-
- All Implemented Interfaces:
HullGenerator
public class MonotoneChain extends Object implements HullGenerator
Implementation of the Andrew's Monotone Chain convex hull algorithm.This implementation is not sensitive to colinear points and returns only the points of the convex hull.
This algorithm is O(n log n) worst case where n is the number of points.
- Since:
- 2.2.0
- Version:
- 3.4.0
- Author:
- William Bittle
-
-
Constructor Summary
Constructors Constructor Description MonotoneChain()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector2[]
generate(Vector2... points)
Returns a convex hull generated from the given point set in counter-clockwise point order.
-
-
-
Method Detail
-
generate
public Vector2[] generate(Vector2... points)
Description copied from interface:HullGenerator
Returns a convex hull generated from the given point set in counter-clockwise point order.Returns null if the given points array is null.
Returns the array unchanged if the length is less than or equal to 2.
- Specified by:
generate
in interfaceHullGenerator
- Parameters:
points
- the point set or cloud- Returns:
Vector2
[] the convex hull vertices
-
-