src/main/java/de/javagl/geom/ConvexHull.java
/**
     * Given the sorted list of points, with point 0 being the reference
     * point: Create a list containing the points that have a unique
     * angle referring to the reference point. When two points have
     * the same angle, then the point that is further away from the
     * reference point will be kept.
     * 
     * @param points The input points
     * @return The points with unique angles
     */
Given the sorted list of points, with point 0 being the reference
point: Create a list containing the points that have a unique
angle referring to the reference point. When two points have
the same angle, then the point that is further away from the
reference point will be kept.

@param points The input points
@return The points with unique angles
Given the sorted list of points with point 0 being the reference point : Create a list containing the points that have a unique angle referring to the reference point . When two points have the same angle then the point that is further away from the reference point will be kept . @param points The input points @return The points with unique angles
private static List<Point2D> makeAnglesUnique(List<Point2D> points)
    {
        Point2D referencePoint = points.get(0);
        List<Point2D> newPoints = new ArrayList<Point2D>();
        newPoints.add(referencePoint);
        double previousAngle = Math.PI * 2;
        double previousDistanceSquared = Double.MAX_VALUE;
        for (int i=1; i<points.size(); i++)
        {
            Point2D p = points.get(i);
            double angle = Lines.angleToX(referencePoint, p);
            if (Math.abs(angle - previousAngle) > Geom.DOUBLE_EPSILON)
            {
                newPoints.add(p);
            }
            else
            {
                double distanceSquared = referencePoint.distanceSq(p);
                if (distanceSquared > previousDistanceSquared)
                {
                    newPoints.set(newPoints.size()-1, p);
                }
            }
            previousAngle = angle;
            previousDistanceSquared = referencePoint.distanceSq(p);
        }
        return newPoints;
    }
private static List < Point2D > makeAnglesUnique ( List < Point2D > points ) { Point2D referencePoint = points . get ( 0 ) ; List < Point2D > newPoints = new ArrayList < Point2D > ( ) ; newPoints . add ( referencePoint ) ; double previousAngle = Math . PI * 2 ; double previousDistanceSquared = Double . MAX_VALUE ; for ( int i = 1 ; i < points . size ( ) ; i ++ ) { Point2D p = points . get ( i ) ; double angle = Lines . angleToX ( referencePoint , p ) ; if ( Math . abs ( angle - previousAngle ) > Geom . DOUBLE_EPSILON ) { newPoints . add ( p ) ; } else { double distanceSquared = referencePoint . distanceSq ( p ) ; if ( distanceSquared > previousDistanceSquared ) { newPoints . set ( newPoints . size ( ) - 1 , p ) ; } } previousAngle = angle ; previousDistanceSquared = referencePoint . distanceSq ( p ) ; } return newPoints ; }
Given the sorted list of points, with point 0 being the reference
 point: Create a list containing the points that have a unique
 angle referring to the reference point.
Given the sorted list of points with point 0 being the reference point : Create a list containing the points that have a unique angle referring to the reference point .