Example #1
0
 public void TestRayStartingBehind()
 {
     Assert.IsFalse(
         Ray3Triangle3Collider.FindContacts(
             new Vector3(1.75f, 1.5f, 1.0f), Vector3.Normalize(Vector3.One),
             Vector3.Zero, Vector3.UnitX, Vector3.UnitX + Vector3.UnitY
             ).HasContact
         );
 }
Example #2
0
        public void TestHitThroughCenter()
        {
            LineContacts contacts = Ray3Triangle3Collider.FindContacts(
                new Vector3(-0.25f, -0.5f, -1.0f), Vector3.Normalize(Vector3.One),
                Vector3.Zero, Vector3.UnitX, Vector3.UnitX + Vector3.UnitY
                );
            float contactTime = 1.0f / Vector3.Normalize(Vector3.One).Z;

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