/// <summary>Extends the box to encompass the specified point (if needed). </summary> public void Merge(Vector3 point) { if (_extent != Extent.Null) { if (_extent != Extent.Finite) { if (_extent != Extent.Infinite) { throw new Exception(" Should never reach here"); } } else { _maximum.MakeCeil(point); _minimum.MakeFloor(point); } } else { SetExtents(point, point); } }
/// <summary> /// Merges the passed in box into the current box. The result is the box which encompasses both. /// </summary> public void Merge(AxisAlignedBox rhs) { if (rhs._extent != Extent.Null && _extent != Extent.Infinite) { if (rhs._extent == Extent.Infinite) { _extent = Extent.Infinite; } else if (_extent == Extent.Null) { SetExtents(rhs._minimum, rhs._maximum); } else { Vector3 min = _minimum; Vector3 max = _maximum; max.MakeCeil(rhs._maximum); min.MakeFloor(rhs._minimum); SetExtents(min, max); } } }