Пример #1
0
 @Override // from IBox
 public boolean intersects(IBox other) {
   IVector3 omin = other.minimumExtent(), omax = other.maximumExtent();
   return _maxExtent.x >= omin.x()
       && _minExtent.x <= omax.x()
       && _maxExtent.y >= omin.y()
       && _minExtent.y <= omax.y()
       && _maxExtent.z >= omin.z()
       && _minExtent.z <= omax.z();
 }
Пример #2
0
 @Override // from IBox
 public boolean contains(IBox other) {
   IVector3 omin = other.minimumExtent(), omax = other.maximumExtent();
   return omin.x() >= _minExtent.x
       && omax.x() <= _maxExtent.x
       && omin.y() >= _minExtent.y
       && omax.y() <= _maxExtent.y
       && omin.z() >= _minExtent.z
       && omax.z() <= _maxExtent.z;
 }
Пример #3
0
 @Override // from IBox
 public Box intersect(IBox other, Box result) {
   IVector3 omin = other.minimumExtent(), omax = other.maximumExtent();
   result._minExtent.set(
       Math.max(_minExtent.x, omin.x()),
       Math.max(_minExtent.y, omin.y()),
       Math.max(_minExtent.z, omin.z()));
   result._maxExtent.set(
       Math.min(_maxExtent.x, omax.x()),
       Math.min(_maxExtent.y, omax.y()),
       Math.min(_maxExtent.z, omax.z()));
   return result;
 }
Пример #4
0
 /**
  * Copies the parameters of another box.
  *
  * @return a reference to this box, for chaining.
  */
 public Box set(IBox other) {
   return set(other.minimumExtent(), other.maximumExtent());
 }
Пример #5
0
 @Override // from IBox
 public double extentDistance(IBox other) {
   return other.minimumExtent().manhattanDistance(_minExtent)
       + other.maximumExtent().manhattanDistance(_maxExtent);
 }