Example #1
0
 public void TestRayStartingBehind()
 {
     Assert.IsFalse(
         Ray2Aabb2Collider.FindContacts(
             Vector2.UnitX * 3.0f, Vector2.UnitX, new Vector2(2.0f, 2.0f)
             ).HasContact
         );
 }
Example #2
0
        public void TestRayStartingInside()
        {
            LineContacts contacts = Ray2Aabb2Collider.FindContacts(
                Vector2.Zero, Vector2.UnitX, new Vector2(2.0f, 2.0f)
                );

            Assert.That(
                contacts.EntryTime,
                Is.EqualTo(0.0f).Within(Specifications.MaximumDeviation).Ulps
                );
            Assert.That(
                contacts.ExitTime,
                Is.EqualTo(2.0f).Within(Specifications.MaximumDeviation).Ulps
                );
        }