コード例 #1
0
 public void TestRayStartingBehind()
 {
     Assert.IsFalse(
         Ray2Disc2Collider.FindContacts(
             Vector2.UnitX * 3.0f, Vector2.UnitX, 2.0f
             ).HasContact
         );
 }
コード例 #2
0
        public void TestRayStartingBehindWithAbsoluteDiscPosition()
        {
            Vector2 unitDiagonal = Vector2.Normalize(Vector2.One);

            Assert.IsFalse(
                Ray2Disc2Collider.FindContacts(
                    unitDiagonal * 6.0f, unitDiagonal, unitDiagonal * 3.0f, 2.0f
                    ).HasContact
                );
        }
コード例 #3
0
        public void TestRayStartingInside()
        {
            LineContacts contacts = Ray2Disc2Collider.FindContacts(
                new Vector2(0.0f, 0.0f), Vector2.UnitX, 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
                );
        }
コード例 #4
0
        public void TestRayStartingInsideWithAbsoluteDiscPosition()
        {
            Vector2      unitDiagonal = Vector2.Normalize(Vector2.One);
            LineContacts contacts     = Ray2Disc2Collider.FindContacts(
                unitDiagonal * 4.0f, unitDiagonal, unitDiagonal * 5.0f, 2.0f
                );

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