/// <summary> /// Determine whether this interval intersects another. /// </summary> /// <remarks>Same as !Disjoint(...)</remarks> /// <param name="other">Other interval.</param> /// <returns>Whether there is an intersection.</returns> public bool IntersectsWith(IInterval <TPoint, TSpan, TEndpoint, T> other) { return ((this.PointIsWithin(other.Left) && ((this.RightEndpoint.Inclusive && other.LeftEndpoint.Inclusive) || this.Right.CompareTo(other.Left) != 0)) || (this.PointIsWithin(other.Right) && ((this.LeftEndpoint.Inclusive && other.RightEndpoint.Inclusive) || this.Left.CompareTo(other.Right) != 0)) || (other.PointIsWithin(this.Left) && other.PointIsWithin(this.Right))); }
/// <summary> /// Determine whether this interval is a subset of another. /// </summary> /// <remarks>Subset may be equal (see <see cref="IsProperSubsetOf(IInterval{TPoint, TSpan, TEndpoint, T})"/>).</remarks> /// <param name="other">Other interval.</param> /// <returns>Whether this is a subset of the other.</returns> public bool IsSubsetOf(IInterval <TPoint, TSpan, TEndpoint, T> other) { return(other.PointIsWithin(this.Left) && other.PointIsWithin(this.Right)); }