コード例 #1
0
        public void TestIntersectsRectangleByReference()
        {
            BoundingRectangle rectangle = new BoundingRectangle(
                10.0f, 20.0f, 30.0f, 40.0f
                );
            BoundingRectangle nonTouching = new BoundingRectangle(
                31.0f, 41.0f, 50.0f, 60.0f
                );
            BoundingRectangle touching = new BoundingRectangle(
                29.0f, 39.0f, 50.0f, 60.0f
                );

            bool result;

            rectangle.Intersects(ref nonTouching, out result);
            Assert.IsFalse(result);

            rectangle.Intersects(ref touching, out result);
            Assert.IsTrue(result);
        }
コード例 #2
0
    public void TestIntersectsRectangleByReference() {
      BoundingRectangle rectangle = new BoundingRectangle(
        10.0f, 20.0f, 30.0f, 40.0f
      );
      BoundingRectangle nonTouching = new BoundingRectangle(
        31.0f, 41.0f, 50.0f, 60.0f
      );
      BoundingRectangle touching = new BoundingRectangle(
        29.0f, 39.0f, 50.0f, 60.0f
      );

      bool result;

      rectangle.Intersects(ref nonTouching, out result);
      Assert.IsFalse(result);

      rectangle.Intersects(ref touching, out result);
      Assert.IsTrue(result);
    }
コード例 #3
0
    public void TestIntersectsRectangle() {
      BoundingRectangle rectangle = new BoundingRectangle(
        10.0f, 20.0f, 30.0f, 40.0f
      );
      BoundingRectangle nonTouching = new BoundingRectangle(
        31.0f, 41.0f, 50.0f, 60.0f
      );
      BoundingRectangle touching = new BoundingRectangle(
        29.0f, 39.0f, 50.0f, 60.0f
      );

      Assert.IsFalse(rectangle.Intersects(nonTouching));
      Assert.IsTrue(rectangle.Intersects(touching));
    }