예제 #1
0
        public void TestCombine()
        {
            AABB2D aabb = new AABB2D();

            aabb.Combine(Vector2.one);
            Assert.AreEqual(aabb.min, Vector2.zero);
            Assert.AreEqual(aabb.max, Vector2.one);

            aabb.Combine(-Vector2.one);
            Assert.AreEqual(aabb.min, -Vector2.one);
            Assert.AreEqual(aabb.max, Vector2.one);

            aabb.Reset();

            aabb.Combine(aabbOne);
            Assert.AreEqual(aabb.min, -Vector2.one);
            Assert.AreEqual(aabb.max, Vector2.one);

            aabb.Combine(aabbOneTwo);
            Assert.AreEqual(aabb.min, -Vector2.one);
            Assert.AreEqual(aabb.max, Vector2.two);

            aabb = AABB2D.Combine(Vector2.one, -Vector2.one);
            Assert.AreEqual(aabb.min, -Vector2.one);
            Assert.AreEqual(aabb.max, Vector2.one);

            aabb = AABB2D.Combine(aabbOne, aabbOneTwo);
            Assert.AreEqual(aabb.min, -Vector2.one);
            Assert.AreEqual(aabb.max, Vector2.two);
        }