private HitTestResult HitTest(IHittable obj, Coordinates point, double tolerance, HitTestFilter filter) { // check if we're in the bounding box RectangleF boundingBox = obj.GetBoundingBox(); // inflate by the tolerance if (!boundingBox.IsEmpty) { boundingBox.Inflate((float)tolerance, (float)tolerance); } // check if the bounding box is empty or we're inside it if (boundingBox.IsEmpty || boundingBox.Contains(Utility.ToPointF(point))) { // run the hit test HitTestResult result = obj.HitTest(point, (float)tolerance); // apply the filter if (filter(result)) { return(result); } } // return a no-hit return(HitTestResult.NoHit); }
private HitTestResult HitTest(IHittable obj, Coordinates point, double tolerance, HitTestFilter filter) { // check if we're in the bounding box RectangleF boundingBox = obj.GetBoundingBox(); // inflate by the tolerance if (!boundingBox.IsEmpty) { boundingBox.Inflate((float)tolerance, (float)tolerance); } // check if the bounding box is empty or we're inside it if (boundingBox.IsEmpty || boundingBox.Contains(Utility.ToPointF(point))) { // run the hit test HitTestResult result = obj.HitTest(point, (float)tolerance); // apply the filter if (filter(result)) { return result; } } // return a no-hit return HitTestResult.NoHit; }