protected override object ComputeBounds() { Interval bounds = null; foreach(object obj in GetChildBoundables() ) { IBoundable childBoundable = (IBoundable) obj; if (bounds == null) { bounds = new Interval((Interval)childBoundable.GetBounds()); } else { bounds.ExpandToInclude((Interval)childBoundable.GetBounds()); } } return bounds; }
/** * @return this */ public Interval ExpandToInclude(Interval other) { _max = Math.Max(_max, other.Max); _min = Math.Min(_min, other.Min); return this; }
public bool Intersects(Interval other) { return !(other.Min > _max || other.Max < _min); }
public Interval(Interval other) :this(other._min, other._max) { }