Class ConvexHull2D
java.lang.Object
org.episteme.core.mathematics.geometry.ConvexHull2D
Robust 2D Convex Hull implementation using the Monotone Chain algorithm.
Time complexity: O(n log n)
The algorithm:
- Sort points lexicographically (by x, then by y)
- Build lower hull by processing points left-to-right
- Build upper hull by processing points right-to-left
- Concatenate hulls (removing duplicate endpoints)
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionComputes the convex hull of a set of 2D points.Computes the convex hull from an array.static RealcomputeArea(List<Point2D> points) Computes the area of the convex hull.static RealcomputeDiameter(List<Point2D> points) Computes the diameter of the convex hull (rotating calipers).static RealcomputePerimeter(List<Point2D> points) Computes the perimeter of the convex hull.static ConvexPolygon2DcomputePolygon(List<Point2D> points) Creates a ConvexPolygon2D from the hull.static Point2DfindFarthest(List<Point2D> points, Point2D queryPoint) Finds the point on the hull farthest from a given point.static booleanChecks if a set of points is already convex (in convex position).
-
Method Details
-
compute
-
compute
-
computePolygon
Creates a ConvexPolygon2D from the hull.- Parameters:
points- the input points- Returns:
- a convex polygon boundary
-
isConvex
-
computeArea
-
computePerimeter
-
findFarthest
-
computeDiameter
-