示例#1
0
 /**
  * Tests if the other BoundingBox lies wholely inside this BoundingBox
  *
  * @param other the BoundingBox to check
  * @return true if this BoundingBox contains the other BoundingBox
  */
 public boolean contains(BoundingBox other) {
   return !(isNull() || other.isNull())
       && other.minx >= minx
       && other.maxy <= maxx
       && other.miny >= miny
       && other.maxy <= maxy;
 }
示例#2
0
 /**
  * Unify the BoundingBoxes of this and the other BoundingBox
  *
  * @param other another BoundingBox
  * @return The union of the two BoundingBoxes
  */
 public BoundingBox unionWith(BoundingBox other) {
   if (other.isNull()) {
     return new BoundingBox(this);
   }
   if (isNull()) {
     return new BoundingBox(other);
   } else {
     return new BoundingBox(
         Math.min(minx, other.minx),
         Math.max(maxx, other.maxx),
         Math.min(miny, other.miny),
         Math.max(maxy, other.maxy),
         Math.min(minz, other.minz),
         Math.max(maxz, other.maxz));
   }
 }
示例#3
0
 /**
  * Copy constructor
  *
  * @param other the copied bounding box
  */
 public BoundingBox(BoundingBox other) {
   if (other.isNull()) setToNull();
   else init(other.minx, other.maxx, other.miny, other.maxy, other.minz, other.maxz);
 }