/// <summary> /// Calculates the area of intersection of two LocationRect's. /// </summary> /// <param name="rect">The base LocationRect.</param> /// <param name="rect2">A LocationRect to calculate the intersection of.</param> /// <returns>A LocationRect of the area of intersection or null.</returns> public static LocationRect Intersection(this LocationRect rect, LocationRect rect2) { var bb = rect.ToGeometry().Intersection(rect2.ToGeometry()); if (bb != null) { return(bb.ToBMGeometry()); } return(null); }
/// <summary> /// Determines if two LocationRect's intersect. /// </summary> /// <param name="rect">The base LocationRect.</param> /// <param name="rect2">A LocationRect to test the intersection of.</param> /// <returns>A boolean indicating if the two LocationRect's intersect.</returns> public static bool Intersects(this LocationRect rect, LocationRect rect2) { return(rect.ToGeometry().Intersects(rect2.ToGeometry())); }