private static List < Point > simplifyDouglasPeucker ( List < Point > points , double sqTolerance ) { int last = points . size ( ) - 1 ; ArrayList < Point > simplified = new ArrayList <> ( ) ; simplified . add ( points . get ( 0 ) ) ; simplified . addAll ( simplifyDpStep ( points , 0 , last , sqTolerance , simplified ) ) ; simplified . add ( points . get ( last ) ) ; return simplified ; }
Simplification using Ramer - Douglas - Peucker algorithm .