コード例 #1
0
        public void TestContainsPointByReference()
        {
            BoundingRectangle rectangle = new BoundingRectangle(
                new Vector2(10.0f, 20.0f), new Vector2(30.0f, 40.0f)
                );

            ContainmentType type;

            Vector2 point = new Vector2(9.9f, 19.9f);

            rectangle.Contains(ref point, out type);
            Assert.AreEqual(ContainmentType.Disjoint, type);

            point = new Vector2(10.1f, 20.1f);
            rectangle.Contains(ref point, out type);
            Assert.AreEqual(ContainmentType.Contains, type);

            point = new Vector2(29.9f, 39.9f);
            rectangle.Contains(ref point, out type);
            Assert.AreEqual(ContainmentType.Contains, type);

            point = new Vector2(30.1f, 40.1f);
            rectangle.Contains(ref point, out type);
            Assert.AreEqual(ContainmentType.Disjoint, type);
        }
コード例 #2
0
        public void TestContainsRectangle()
        {
            BoundingRectangle rectangle = new BoundingRectangle(
                new Vector2(10.0f, 20.0f), new Vector2(30.0f, 40.0f)
                );

            Assert.IsFalse(rectangle.Contains(new BoundingRectangle(5.0f, 15.0f, 15.0f, 25.0f)));
            Assert.IsFalse(rectangle.Contains(new BoundingRectangle(30.1f, 40.1f, 35.0f, 45.0f)));
            Assert.IsTrue(rectangle.Contains(new BoundingRectangle(10.1f, 20.1f, 29.9f, 39.9f)));
        }
コード例 #3
0
        public void TestContainsPoint()
        {
            BoundingRectangle rectangle = new BoundingRectangle(
                new Vector2(10.0f, 20.0f), new Vector2(30.0f, 40.0f)
                );

            Assert.IsFalse(rectangle.Contains(new Vector2(9.9f, 19.9f)));
            Assert.IsTrue(rectangle.Contains(new Vector2(10.1f, 20.1f)));

            Assert.IsTrue(rectangle.Contains(new Vector2(29.9f, 39.9f)));
            Assert.IsFalse(rectangle.Contains(new Vector2(30.1f, 40.1f)));
        }
コード例 #4
0
        public void TestContainsRectangleByReference()
        {
            BoundingRectangle rectangle = new BoundingRectangle(
                new Vector2(10.0f, 20.0f), new Vector2(30.0f, 40.0f)
                );

            ContainmentType type;

            BoundingRectangle touching = new BoundingRectangle(5.0f, 15.0f, 15.0f, 25.0f);

            rectangle.Contains(ref touching, out type);
            Assert.AreEqual(ContainmentType.Intersects, type);

            BoundingRectangle outside = new BoundingRectangle(30.1f, 40.1f, 35.0f, 45.0f);

            rectangle.Contains(ref outside, out type);
            Assert.AreEqual(ContainmentType.Disjoint, type);

            BoundingRectangle contained = new BoundingRectangle(10.1f, 20.1f, 29.9f, 39.9f);

            rectangle.Contains(ref contained, out type);
            Assert.AreEqual(ContainmentType.Contains, type);
        }
コード例 #5
0
    public void TestContainsRectangleByReference() {
      BoundingRectangle rectangle = new BoundingRectangle(
        new Vector2(10.0f, 20.0f), new Vector2(30.0f, 40.0f)
      );

      ContainmentType type;

      BoundingRectangle touching = new BoundingRectangle(5.0f, 15.0f, 15.0f, 25.0f);
      rectangle.Contains(ref touching, out type);
      Assert.AreEqual(ContainmentType.Intersects, type);

      BoundingRectangle outside = new BoundingRectangle(30.1f, 40.1f, 35.0f, 45.0f);
      rectangle.Contains(ref outside, out type);
      Assert.AreEqual(ContainmentType.Disjoint, type);

      BoundingRectangle contained = new BoundingRectangle(10.1f, 20.1f, 29.9f, 39.9f);
      rectangle.Contains(ref contained, out type);
      Assert.AreEqual(ContainmentType.Contains, type);
    }
コード例 #6
0
    public void TestContainsRectangle() {
      BoundingRectangle rectangle = new BoundingRectangle(
        new Vector2(10.0f, 20.0f), new Vector2(30.0f, 40.0f)
      );

      Assert.IsFalse(rectangle.Contains(new BoundingRectangle(5.0f, 15.0f, 15.0f, 25.0f)));
      Assert.IsFalse(rectangle.Contains(new BoundingRectangle(30.1f, 40.1f, 35.0f, 45.0f)));
      Assert.IsTrue(rectangle.Contains(new BoundingRectangle(10.1f, 20.1f, 29.9f, 39.9f)));
    }
コード例 #7
0
    public void TestContainsPointByReference() {
      BoundingRectangle rectangle = new BoundingRectangle(
        new Vector2(10.0f, 20.0f), new Vector2(30.0f, 40.0f)
      );

      ContainmentType type;

      Vector2 point = new Vector2(9.9f, 19.9f);
      rectangle.Contains(ref point, out type);
      Assert.AreEqual(ContainmentType.Disjoint, type);

      point = new Vector2(10.1f, 20.1f);
      rectangle.Contains(ref point, out type);
      Assert.AreEqual(ContainmentType.Contains, type);

      point = new Vector2(29.9f, 39.9f);
      rectangle.Contains(ref point, out type);
      Assert.AreEqual(ContainmentType.Contains, type);

      point = new Vector2(30.1f, 40.1f);
      rectangle.Contains(ref point, out type);
      Assert.AreEqual(ContainmentType.Disjoint, type);
    }
コード例 #8
0
    public void TestContainsPoint() {
      BoundingRectangle rectangle = new BoundingRectangle(
        new Vector2(10.0f, 20.0f), new Vector2(30.0f, 40.0f)
      );

      Assert.IsFalse(rectangle.Contains(new Vector2(9.9f, 19.9f)));
      Assert.IsTrue(rectangle.Contains(new Vector2(10.1f, 20.1f)));

      Assert.IsTrue(rectangle.Contains(new Vector2(29.9f, 39.9f)));
      Assert.IsFalse(rectangle.Contains(new Vector2(30.1f, 40.1f)));
    }