/** * Filter out vertices that create "peaks" or barely stick out the line described by the previous and next vertices. * Peaks are identified by a threshold on the angle between two consecutive edges. * Only convex peaks or shallow angles are removed, meaning this filter only reduces the area of the concave hull. * @param shallowAngleThreshold should be a small positive angle in radians. 0 will not remove any vertex. * @param peakAngleThreshold should be close to {@link Math#PI}. * @param concaveHullToFilter the concave hull to filter. * @return the number of vertices removed. */ public static int filterOutPeaksAndShallowAngles(double shallowAngleThreshold, double peakAngleThreshold, ConcaveHull concaveHullToFilter) { return filterOutPeaksAndShallowAngles(shallowAngleThreshold, peakAngleThreshold, concaveHullToFilter.getConcaveHullVertices()); }
/** * Filter out vertices that create "peaks" or barely stick out the line described by the previous and next vertices. * Peaks are identified by a threshold on the angle between two consecutive edges. * Only convex peaks or shallow angles are removed, meaning this filter only reduces the area of the concave hull. * @param shallowAngleThreshold should be a small positive angle in radians. 0 will not remove any vertex. * @param peakAngleThreshold should be close to {@link Math#PI}. * @param concaveHullCollectionToFilter the collection of concave hulls to filter. * @return the number of vertices removed. */ public static int filterOutPeaksAndShallowAngles(double shallowAngleThreshold, double peakAngleThreshold, ConcaveHullCollection concaveHullCollectionToFilter) { int numberOfVerticesRemoved = 0; for (ConcaveHull concaveHullToFilter : concaveHullCollectionToFilter) numberOfVerticesRemoved += filterOutPeaksAndShallowAngles(shallowAngleThreshold, peakAngleThreshold, concaveHullToFilter.getConcaveHullVertices()); return numberOfVerticesRemoved; }
ConcaveHullPruningFilteringTools.filterOutPeaksAndShallowAngles(shallowAngleThreshold, peakAngleThreshold, concaveHullCollection); ConcaveHullPruningFilteringTools.filterOutShortEdges(lengthThreshold, concaveHullCollection);