Exemplo n.º 1
0
        public void OverlapsVerifivation()
        {
            Rect testRect1 = new Rect(32.0f, 0.0f, 32.0f, 36.0f);
            Rect testRect2 = new Rect(0.0f, 0.0f, 32.0f, 56.0f);
            Rect testRect3 = new Rect(1.0f, 1.0f, 1.0f, 1.0f);

            Assert.IsFalse(RectUtility.Overlaps(testRect1, testRect2), "Bordering rectangles should return false");             // Borders
            Assert.IsFalse(RectUtility.Overlaps(testRect1, testRect3), "Bordering rectangles should return false");             // No Overlap
            Assert.IsTrue(RectUtility.Overlaps(testRect2, testRect3), "Overlapping rectangles should return true");             // Overlaps
            Assert.IsTrue(RectUtility.Overlaps(testRect1, testRect1), "Overlapping rectangles should return true");             // Overlaps
        }
Exemplo n.º 2
0
 /// Valid location is defined as an attemptedReservation that doesn't overlap any reservedSpaces
 private static bool IsValidLocation(IEnumerable <Rect> reservedSpaces, Rect attemptedReservation)
 {
     foreach (Rect reservedSpace in reservedSpaces)
     {
         if (RectUtility.Overlaps(attemptedReservation, reservedSpace))
         {
             return(false);
         }
     }
     return(true);
 }