Class FilteredConvexHull2D


  • public class FilteredConvexHull2D
    extends java.lang.Object
    Accelerate computing the convex hull with a simple filter.

    For this filter, we maintain a simple box that is guaranteed to be fully inside the convex hull. Points in this rectangle will be skipped.

    TODO: allow using this with other bounding box algorithms, too.

    Since:
    0.7.5
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double[] bottomleft
      Top-left point
      private double[] bottomright
      Top-left point
      private double bottomy
      Left bound
      private double leftx
      Left bound
      private java.util.List<double[]> points
      The current set of candidate points.
      private Polygon poly
      Computed polygon.
      private double rightx
      Left bound
      private double[] topleft
      Top-left point
      private double[] topright
      Top-left point
      private double topy
      Left bound
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(double... point)
      Add a single point to the list (this does not compute the hull!)
      private boolean checkCandidate​(double[] point)  
      private boolean checkCandidateUpdate​(double[] point)
      Check whether a point is inside the current bounds, and update the bounds
      private Polygon computeConvexHull()
      Compute the convex hull.
      Polygon getHull()
      Compute the convex hull, and return the resulting polygon.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • points

        private java.util.List<double[]> points
        The current set of candidate points.
      • leftx

        private double leftx
        Left bound
      • rightx

        private double rightx
        Left bound
      • topy

        private double topy
        Left bound
      • bottomy

        private double bottomy
        Left bound
      • topleft

        private double[] topleft
        Top-left point
      • topright

        private double[] topright
        Top-left point
      • bottomright

        private double[] bottomright
        Top-left point
      • bottomleft

        private double[] bottomleft
        Top-left point
      • poly

        private Polygon poly
        Computed polygon.
    • Constructor Detail

      • FilteredConvexHull2D

        public FilteredConvexHull2D()
        Constructor.
    • Method Detail

      • add

        public void add​(double... point)
        Add a single point to the list (this does not compute the hull!)
        Parameters:
        point - Point to add
      • computeConvexHull

        private Polygon computeConvexHull()
        Compute the convex hull.
        Returns:
        resulting polygon
      • checkCandidate

        private boolean checkCandidate​(double[] point)
      • checkCandidateUpdate

        private boolean checkCandidateUpdate​(double[] point)
        Check whether a point is inside the current bounds, and update the bounds
        Parameters:
        point - New point
        Returns:
        true if the point is potentially on the hull
      • getHull

        public Polygon getHull()
        Compute the convex hull, and return the resulting polygon.
        Returns:
        Polygon of the hull