/** * Decides whether we would benefit from using a mosaic instead of a crop * * @param parameters * @param finalGridRange * @param points * @return * @throws InvalidParameterTypeException * @throws ParameterNotFoundException */ private static boolean decideJAIOperation( final double roiTolerance, final Rectangle2D finalGridRange, final List<Point2D> points) throws InvalidParameterTypeException, ParameterNotFoundException { final double cropArea = finalGridRange.getWidth() * finalGridRange.getHeight(); final double roiArea = Math.abs(FeatureUtilities.area((Point2D[]) points.toArray(new Point2D[] {}))); final boolean doMosaic = roiTolerance * cropArea > roiArea; return doMosaic; }