/** * Redefines this bounding box to be the same as the given {@code other}. * * @param other the bounding box used to redefine this bounding box. Not modified. */ @Override public void set(BoundingBox2D other) { BoundingBox2DBasics.super.set(other); }
/** * Sets this bounding box to the union of {@code boundingBoxOne} and {@code boundingBoxTwo}. * <p> * This bounding box is set such that it is the smallest bounding box containing the two given * bounding boxes. * </p> * * @param boundingBoxOne the first bounding box. Can be the same instance as this. Not modified. * @param boundingBoxTwo the second bounding box. Can be the same instance as this. Not modified. */ default void combine(BoundingBox2DReadOnly boundingBoxOne, BoundingBox2DReadOnly boundingBoxTwo) { double minX = Math.min(boundingBoxOne.getMinX(), boundingBoxTwo.getMinX()); double minY = Math.min(boundingBoxOne.getMinY(), boundingBoxTwo.getMinY()); double maxX = Math.max(boundingBoxOne.getMaxX(), boundingBoxTwo.getMaxX()); double maxY = Math.max(boundingBoxOne.getMaxY(), boundingBoxTwo.getMaxY()); set(minX, minY, maxX, maxY); }