private DoublePair findMinAndMaxY() { DoublePair border = new DoublePair(Double.MAX_VALUE, -Double.MAX_VALUE); surfaces .stream() .forEach( current -> { DoublePair pair = current.getMinimumAndMaximumY(); listSurfacesEvents.addEvent( new SurfaceEvent(current, true), (int) pair.getMaxValue()); listSurfacesEvents.addEvent( new SurfaceEvent(current, false), (int) pair.getMinValue()); borders.add(pair.getMaxValue()); borders.add(pair.getMinValue()); border.changeValue(pair); }); return border; }
private void changeDrawnSurfacesList(int currentY, boolean isAdd) { ArrayList<SurfaceEvent> events = listSurfacesEvents.getEvent(currentY); if (events == null) { return; } events .stream() .forEach( event -> { if (isAdd && event.isStart) { drawnSurfaces.add(event.surface); } else if (!isAdd && !event.isStart) { drawnSurfaces.remove(event.surface); } }); }