public void TestIntersect() { Assert.IsTrue(aabbOne.IsIntersect(aabbHalf)); Assert.IsTrue(aabbOne.IsIntersect(aabbZeroTwo)); Assert.IsTrue(aabbOne.IsIntersect(aabbOneTwo)); Assert.IsTrue(aabbHalf.IsIntersect(aabbOne)); Assert.IsTrue(aabbHalf.IsIntersect(aabbZeroTwo)); Assert.IsFalse(aabbHalf.IsIntersect(aabbOneTwo)); Assert.IsTrue(aabbZeroTwo.IsIntersect(aabbOne)); Assert.IsTrue(aabbZeroTwo.IsIntersect(aabbHalf)); Assert.IsTrue(aabbZeroTwo.IsIntersect(aabbOneTwo)); Assert.IsTrue(aabbOneTwo.IsIntersect(aabbOne)); Assert.IsFalse(aabbOneTwo.IsIntersect(aabbHalf)); Assert.IsTrue(aabbOneTwo.IsIntersect(aabbZeroTwo)); AABB2D result; result = AABB2D.Intersect(aabbOne, aabbHalf); Assert.IsNotNull(result); Assert.AreEqual(result.min, aabbHalf.min); Assert.AreEqual(result.max, aabbHalf.max); result = AABB2D.Intersect(aabbOne, aabbZeroTwo); Assert.IsNotNull(result); Assert.AreEqual(result.min, aabbZeroTwo.min); Assert.AreEqual(result.max, aabbOne.max); result = AABB2D.Intersect(aabbOne, aabbOneTwo); Assert.IsNotNull(result); Assert.AreEqual(result.min, aabbOneTwo.min); Assert.AreEqual(result.max, aabbOne.max); result = AABB2D.Intersect(aabbHalf, aabbZeroTwo); Assert.IsNotNull(result); Assert.AreEqual(result.min, aabbZeroTwo.min); Assert.AreEqual(result.max, aabbHalf.max); result = AABB2D.Intersect(aabbHalf, aabbOneTwo); Assert.IsNotNull(result); Assert.IsTrue(result.IsEmpty()); result = AABB2D.Intersect(aabbZeroTwo, aabbOneTwo); Assert.IsNotNull(result); Assert.AreEqual(result.min, aabbOneTwo.min); Assert.AreEqual(result.max, aabbOneTwo.max); result = AABB2D.Intersect(aabbZeroTwo, aabbOneTwo.min, aabbOneTwo.max); Assert.IsNotNull(result); Assert.AreEqual(result.min, aabbOneTwo.min); Assert.AreEqual(result.max, aabbOneTwo.max); float distance = 0; bool ret = aabbOneTwo.Raycast(new Ray2D(new Vector2(-1f, 1f), new Vector2(1f, 0f)), out distance); Assert.IsTrue(ret); Assert.AreEqual(distance, 2f); }