public IEnumerable<ISide> GetSides(Direction direction, Range positionRange, Range boundsRange, bool ascending = true) { return _directionSidesMap[(int) direction] .Where(s => positionRange.Contains(s.Position) && boundsRange.IsIntersect(new Range(s.Begin, true, s.End, true))) .OrderBy(s => ascending ? s.Position : -s.Position); }