Class AbstractConvexHullGenerator2D

java.lang.Object
org.apache.commons.math3.geometry.euclidean.twod.hull.AbstractConvexHullGenerator2D
All Implemented Interfaces:
ConvexHullGenerator2D, ConvexHullGenerator<Euclidean2D,Vector2D>
Direct Known Subclasses:
MonotoneChain

abstract class AbstractConvexHullGenerator2D extends Object implements ConvexHullGenerator2D
Abstract base class for convex hull generators in the two-dimensional euclidean space.
Since:
3.3
  • Field Details

    • DEFAULT_TOLERANCE

      private static final double DEFAULT_TOLERANCE
      Default value for tolerance.
      See Also:
    • tolerance

      private final double tolerance
      Tolerance below which points are considered identical.
    • includeCollinearPoints

      private final boolean includeCollinearPoints
      Indicates if collinear points on the hull shall be present in the output. If false, only the extreme points are added to the hull.
  • Constructor Details

    • AbstractConvexHullGenerator2D

      protected AbstractConvexHullGenerator2D(boolean includeCollinearPoints)
      Simple constructor.

      The default tolerance (1e-10) will be used to determine identical points.

      Parameters:
      includeCollinearPoints - indicates if collinear points on the hull shall be added as hull vertices
    • AbstractConvexHullGenerator2D

      protected AbstractConvexHullGenerator2D(boolean includeCollinearPoints, double tolerance)
      Simple constructor.
      Parameters:
      includeCollinearPoints - indicates if collinear points on the hull shall be added as hull vertices
      tolerance - tolerance below which points are considered identical
  • Method Details

    • getTolerance

      public double getTolerance()
      Get the tolerance below which points are considered identical.
      Returns:
      the tolerance below which points are considered identical
    • isIncludeCollinearPoints

      public boolean isIncludeCollinearPoints()
      Returns if collinear points on the hull will be added as hull vertices.
      Returns:
      true if collinear points are added as hull vertices, or false if only extreme points are present.
    • generate

      Builds the convex hull from the set of input points.
      Specified by:
      generate in interface ConvexHullGenerator<Euclidean2D,Vector2D>
      Specified by:
      generate in interface ConvexHullGenerator2D
      Parameters:
      points - the set of input points
      Returns:
      the convex hull
      Throws:
      NullArgumentException - if the input collection is null
      ConvergenceException - if generator fails to generate a convex hull for the given set of input points
    • findHullVertices

      protected abstract Collection<Vector2D> findHullVertices(Collection<Vector2D> points)
      Find the convex hull vertices from the set of input points.
      Parameters:
      points - the set of input points
      Returns:
      the convex hull vertices in CCW winding