public bool HitTest(RectF rect, float scale) { rect.Intersect(_bounds); var v1 = (rect.TopLeft - Center).Length; var v2 = (rect.BottomLeft - Center).Length; var v3 = (rect.TopRight - Center).Length; var v4 = (rect.BottomRight - Center).Length; if (v1 > Radius && v2 > Radius && v3 > Radius && v4 > Radius) { return((rect.Left < Center.X && rect.Right > Center.X) || (rect.Top < Center.Y && rect.Bottom > Center.Y)); } if (!Filled && v1 < Radius && v2 < Radius && v3 < Radius && v4 < Radius) { return(false); } if (!IsCicle) { return(GeometryHelper.IsIntersect(this, rect, v1, v2, v3, v4)); } return(true); }
public static RectF Intersect(RectF rect1, RectF rect2) { rect1.Intersect(rect2); return(rect1); }