public boolean intersects(BaseBounds other) {
   if ((other == null) || other.isEmpty() || isEmpty()) {
     return false;
   }
   return (other.getMaxX() >= minX
       && other.getMaxY() >= minY
       && other.getMaxZ() >= getMinZ()
       && other.getMinX() <= maxX
       && other.getMinY() <= maxY
       && other.getMinZ() <= getMaxZ());
 }
  @Override
  public void intersectWith(BaseBounds other) {
    // Short circuit intersect if either bounds is empty.
    if (this.isEmpty()) return;
    if (other.isEmpty()) {
      makeEmpty();
      return;
    }

    minX = Math.max(minX, other.getMinX());
    minY = Math.max(minY, other.getMinY());
    maxX = Math.min(maxX, other.getMaxX());
    maxY = Math.min(maxY, other.getMaxY());
  }