private static IEnumerable <Boundary <T> > CrossBoundaries(IIntervalSet <T> one, IIntervalSet <T> other) { foreach (Boundary <T> otherBoundary in other.Boundaries) { BoundaryKind cross = one.Cross(otherBoundary.Location)?.Cross(otherBoundary.Kind); if (cross != null) { yield return(new Boundary <T>(otherBoundary.Location, cross)); } } }
private static IEnumerable <Boundary <T> > PlusBoundaries(IIntervalSet <T> one, IIntervalSet <T> other) { foreach (Boundary <T> otherBoundary in other.Boundaries) { BoundaryKind cross = one.Cross(otherBoundary.Location); if (cross == null) { yield return(otherBoundary); } else { BoundaryKind plusKind = cross.Plus(otherBoundary.Kind); yield return(new Boundary <T>(otherBoundary.Location, plusKind)); } } }
/// <inheritdoc /> public bool Intersects(IIntervalSet <T> other) { return(!other.Cross(this).IsEmpty); }