public IHit Hit(Rect origin, Rect destination, IEnumerable <IObstacle> ignoring = null) { Rect wrap = new Rect(origin, destination); IEnumerable <IObstacle> boxes = this.FindPossible(wrap.X, wrap.Y, wrap.Width, wrap.Height); if (ignoring != null) { boxes = boxes.Except(ignoring); } IHit nearest = null; foreach (IObstacle other in boxes) { IHit hit = AABB.Hit.Resolve(origin, destination, other); if (hit != null && (nearest == null || hit.IsNearest(nearest, origin.Start))) { nearest = hit; } } return(nearest); }