Module math

Class GrahamScanConvexHull2D

java.lang.Object
de.lmu.ifi.dbs.elki.math.geometry.GrahamScanConvexHull2D

public class GrahamScanConvexHull2D extends Object
Classes to compute the convex hull of a set of points in 2D, using the classic Grahams scan. Also computes a bounding box.
Author:
Erich Schubert
  • Constructor Details

    • GrahamScanConvexHull2D

      public GrahamScanConvexHull2D()
      Constructor.
  • Method Details

    • add

      public void add(Vector point)
      Add a single point to the list (this does not compute the hull!)
      Parameters:
      point - Point to add
    • isLeft

      protected final int isLeft(Vector a, Vector b, Vector o)
      Test whether a point is left of the other wrt. the origin.
      Parameters:
      a - Vector A
      b - Vector B
      o - Origin vector
      Returns:
      +1 when left, 0 when same, -1 when right
    • getHull

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