private static List < Point > simplifyRadialDist ( List < Point > points , double sqTolerance ) { Point prevPoint = points . get ( 0 ) ; ArrayList < Point > newPoints = new ArrayList <> ( ) ; newPoints . add ( prevPoint ) ; Point point = null ; for ( int i = 1 , len = points . size ( ) ; i < len ; i ++ ) { point = points . get ( i ) ; if ( getSqDist ( point , prevPoint ) > sqTolerance ) { newPoints . add ( point ) ; prevPoint = point ; } } if ( ! prevPoint . equals ( point ) ) { newPoints . add ( point ) ; } return newPoints ; }
Basic distance - based simplification .