math.geom2d.polygon.convhull
Class JarvisMarch2D
- java.lang.Object
-
- math.geom2d.polygon.convhull.JarvisMarch2D
-
- All Implemented Interfaces:
- ConvexHull2D
public class JarvisMarch2D extends java.lang.Object implements ConvexHull2D
Computes the convex hull of a set of points as a single Polygon2D by gift wrapping algorithm, also know as Jarvis March. The complexity of the algorithm is of O(n * h), where n is the number of input points and h the number of vertices of the convex hull. This low complexity makes it the best choice algorithm for computing convex hull.
-
-
Constructor Summary
Constructors Constructor and Description JarvisMarch2D()Creates a new Convex hull calculator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Polygon2DconvexHull(java.util.Collection<? extends Point2D> points)Computes the convex hull of a set of points as a single Polygon2D.
-
-
-
Method Detail
-
convexHull
public Polygon2D convexHull(java.util.Collection<? extends Point2D> points)
Computes the convex hull of a set of points as a single Polygon2D. Current implementation start at the point with lowest y-coord. The points are considered in counter-clockwise order. Result is an instance of SimplePolygon2D. Complexity is O(n*h), with n number of points, h number of points of the hull. Worst case complexity is O(n^2).- Specified by:
convexHullin interfaceConvexHull2D- Parameters:
points- a set of points- Returns:
- the convex polygon corresponding to the convex hull
-
-
DMelt 3.0 © DataMelt by jWork.ORG