Expands this bounding box to contain (or border) the specified position. @param posX the x position value @param posY the y position value @param posZ the z position value @return this bounding box (now expanded) @see #contains(double, double, double)
(double posX, double posY, double posZ)
| 577 | * @see #contains(double, double, double) |
| 578 | */ |
| 579 | @NotNull |
| 580 | public BoundingBox union(double posX, double posY, double posZ) { |
| 581 | double newMinX = Math.min(this.minX, posX); |
| 582 | double newMinY = Math.min(this.minY, posY); |
| 583 | double newMinZ = Math.min(this.minZ, posZ); |
| 584 | double newMaxX = Math.max(this.maxX, posX); |
| 585 | double newMaxY = Math.max(this.maxY, posY); |
| 586 | double newMaxZ = Math.max(this.maxZ, posZ); |
| 587 | if (newMinX == this.minX && newMinY == this.minY && newMinZ == this.minZ && newMaxX == this.maxX && newMaxY == this.maxY && newMaxZ == this.maxZ) { |
| 588 | return this; |
| 589 | } |
| 590 | return this.resize(newMinX, newMinY, newMinZ, newMaxX, newMaxY, newMaxZ); |
| 591 | } |
| 592 | |
| 593 | /** |
| 594 | * Expands this bounding box to contain (or border) the specified position. |