/// <summary> /// Returns the union of two <see cref="Bounds3"/> objects. /// </summary> /// <param name="with"><see cref="Bounds3"/> object to unite with.</param> /// <returns>Union of two <see cref="Bounds3"/> objects.</returns> public Bounds3 Union(Bounds3 with) { if (with == null) { throw new ArgumentNullException("with"); } return(new Bounds3(Math.Min(MinX, with.MinX), Math.Min(MinY, with.MinY), Math.Min(MinZ, with.MinZ), Math.Max(MaxX, with.MaxX), Math.Max(MaxY, with.MaxY), Math.Max(MaxZ, with.MaxZ))); }
/// <summary> /// Compares the current <see cref="Bounds3"/> object to the specified object for equivalence. /// </summary> /// <param name="obj">The <see cref="Bounds3"/> object to test for equivalence with the current object.</param> /// <returns> /// <c>true</c> if the two <see cref="Bounds3"/> objects are equal; otherwise, <c>false</c>. /// </returns> public override bool Equals(object obj) { if (obj == null) { return(false); } Bounds3 that = obj as Bounds3; if (that == null) { return(false); } return(minX.Equals(that.minX) && minY.Equals(that.minY) && minZ.Equals(that.minZ) && maxX.Equals(that.maxX) && maxY.Equals(that.MaxY) && maxZ.Equals(that.MaxZ)); }
/// <summary> /// Returns the union of two <see cref="Bounds3"/> objects. /// </summary> /// <param name="with"><see cref="Bounds3"/> object to unite with.</param> /// <returns>Union of two <see cref="Bounds3"/> objects.</returns> public Bounds3 Union(Bounds3 with) { if (with == null) throw new ArgumentNullException ("with"); return new Bounds3 (Math.Min (MinX, with.MinX), Math.Min (MinY, with.MinY), Math.Min (MinZ, with.MinZ), Math.Max (MaxX, with.MaxX), Math.Max (MaxY, with.MaxY), Math.Max (MaxZ, with.MaxZ)); }
/// <summary> /// Checks if the object intersects with specified boundaries. /// </summary> /// <param name="other">The other boundaries.</param> /// <returns> /// <c>True</c> if it intersects, <c>false</c> otherwise. /// </returns> public bool IntersectsWith(Bounds3 other) { return(IntersectsWith(other.minX, other.minY, other.minZ, other.maxX, other.maxY, other.maxZ)); }
/// <summary> /// Checks if the object intersects with specified boundaries. /// </summary> /// <param name="other">The other boundaries.</param> /// <returns> /// <c>True</c> if it intersects, <c>false</c> otherwise. /// </returns> public bool IntersectsWith(Bounds3 other) { return IntersectsWith (other.minX, other.minY, other.minZ, other.maxX, other.maxY, other.maxZ); }