public ActionResult TestOverlap(Rectangle rect1, Rectangle rect2) { var doubleRectangle1 = DoubleRectangleFactory.CreateDoubleRectangleFromWebCoordinates( rect1.StartX, rect1.StartY, rect1.Width, rect1.Height); var doubleRectangle2 = DoubleRectangleFactory.CreateDoubleRectangleFromWebCoordinates( rect2.StartX, rect2.StartY, rect2.Width, rect2.Height); var isOverlaping = RectangleMathHelper.DoesEitherRectangleOverlapTheOther(doubleRectangle1, doubleRectangle2); return(Content(isOverlaping.ToString())); }
public ActionResult TestAll(Rectangle rect1, Rectangle rect2) { var doubleRectangle1 = DoubleRectangleFactory.CreateDoubleRectangleFromWebCoordinates( rect1.StartX, rect1.StartY, rect1.Width, rect1.Height); var doubleRectangle2 = DoubleRectangleFactory.CreateDoubleRectangleFromWebCoordinates( rect2.StartX, rect2.StartY, rect2.Width, rect2.Height); var isOverlap = RectangleMathHelper.DoesEitherRectangleOverlapTheOther(doubleRectangle1, doubleRectangle2); var isContain = RectangleMathHelper.DoesEitherRectangleContainTheOther(doubleRectangle1, doubleRectangle2); var isAdjacent = RectangleMathHelper.IsEitherRectangleAdjacentToTheOther(doubleRectangle1, doubleRectangle2); return(Json(new { isOverlap = isOverlap, isContain = isContain, isAdjacent = isAdjacent })); }