public static Collection<Vector2D> reducePoints(final Collection<Vector2D> points){
  int size=0;
  Vector2D minX=null;
  Vector2D maxX=null;
  Vector2D minY=null;
  Vector2D maxY=null;
  for (  Vector2D p : points) {
    if (minX == null || p.getX() < minX.getX()) {
      minX=p;
    }
    if (maxX == null || p.getX() > maxX.getX()) {
      maxX=p;
    }
    if (minY == null || p.getY() < minY.getY()) {
      minY=p;
    }
    if (maxY == null || p.getY() > maxY.getY()) {
      maxY=p;
    }
    size++;
  }
  if (size < 4) {
    return points;
  }
  final List<Vector2D> quadrilateral=buildQuadrilateral(minY,maxX,maxY,minX);
  if (quadrilateral.size() < 3) {
    return points;
  }
  final List<Vector2D> reducedPoints=new ArrayList<Vector2D>(quadrilateral);
  for (  final Vector2D p : points) {
    if (!insideQuadrilateral(p,quadrilateral)) {
      reducedPoints.add(p);
    }
  }
  return reducedPoints;
}

public static Collection < Vector2D > reducePoints ( final Collection < Vector2D > points ) { int size = 0 ; Vector2D minX = null ; Vector2D maxX = null ; Vector2D minY = null ; Vector2D maxY = null ; for ( Vector2D p : points ) { if ( minX == null || p . getX ( ) < minX . getX ( ) ) { minX = p ; } if ( maxX == null || p . getX ( ) > maxX . getX ( ) ) { maxX = p ; } if ( minY == null || p . getY ( ) < minY . getY ( ) ) { minY = p ; } if ( maxY == null || p . getY ( ) > maxY . getY ( ) ) { maxY = p ; } size ++ ; } if ( size < 4 ) { return points ; } final List < Vector2D > quadrilateral = buildQuadrilateral ( minY , maxX , maxY , minX ) ; if ( quadrilateral . size ( ) < 3 ) { return points ; } final List < Vector2D > reducedPoints = new ArrayList < Vector2D > ( quadrilateral ) ; for ( final Vector2D p : points ) { if ( ! insideQuadrilateral ( p , quadrilateral ) ) { reducedPoints . add ( p ) ; } } return reducedPoints ; }
returns a point set that is reduced by all points for which it is safe to assume that they are not part of the convex hull .
