src/main/java/ch/frostnova/force/based/layout/model/Scene.java
public Rectangle boundingBox() {

        if (shapes.isEmpty()) {
            return new Rectangle(0, 0, 0, 0);
        }

        double minX = Double.POSITIVE_INFINITY;
        double maxX = Double.NEGATIVE_INFINITY;
        double minY = Double.POSITIVE_INFINITY;
        double maxY = Double.NEGATIVE_INFINITY;

        for (Shape shape : shapes) {
            Point location = shape.getLocation();
            Dimension size = shape.getSize();

            minX = Math.min(minX, location.getX());
            maxX = Math.max(maxX, location.getX() + size.getWidth());
            minY = Math.min(minY, location.getY());
            maxY = Math.max(maxY, location.getY() + size.getHeight());
        }
        return new Rectangle(minX, minY, maxX - minX, maxY - minY);
    }
/**
     * Calculate the bounding box (minimal region containing all the shapes) of the scene.
     *
     * @return bounding box
     */
Calculate the bounding box (minimal region containing all the shapes) of the scene.
@return bounding box
Calculate the bounding box ( minimal region containing all the shapes ) of the scene . @return bounding box
public Rectangle boundingBox() {
        if (shapes.isEmpty()) {
            return new Rectangle(0, 0, 0, 0);
        }
        double minX = Double.POSITIVE_INFINITY;
        double maxX = Double.NEGATIVE_INFINITY;
        double minY = Double.POSITIVE_INFINITY;
        double maxY = Double.NEGATIVE_INFINITY;
        for (Shape shape : shapes) {
            Point location = shape.getLocation();
            Dimension size = shape.getSize();
            minX = Math.min(minX, location.getX());
            maxX = Math.max(maxX, location.getX() + size.getWidth());
            minY = Math.min(minY, location.getY());
            maxY = Math.max(maxY, location.getY() + size.getHeight());
        }
        return new Rectangle(minX, minY, maxX - minX, maxY - minY);
    }
public Rectangle boundingBox ( ) { if ( shapes . isEmpty ( ) ) { return new Rectangle ( 0 , 0 , 0 , 0 ) ; } double minX = Double . POSITIVE_INFINITY ; double maxX = Double . NEGATIVE_INFINITY ; double minY = Double . POSITIVE_INFINITY ; double maxY = Double . NEGATIVE_INFINITY ; for ( Shape shape : shapes ) { Point location = shape . getLocation ( ) ; Dimension size = shape . getSize ( ) ; minX = Math . min ( minX , location . getX ( ) ) ; maxX = Math . max ( maxX , location . getX ( ) + size . getWidth ( ) ) ; minY = Math . min ( minY , location . getY ( ) ) ; maxY = Math . max ( maxY , location . getY ( ) + size . getHeight ( ) ) ; } return new Rectangle ( minX , minY , maxX - minX , maxY - minY ) ; }
Calculate the bounding box (minimal region containing all the shapes) of the scene.
Calculate the bounding box ( minimal region containing all the shapes ) of the scene .