public void TestFindOrthogonalContactsOnTriangle() { Areas.Triangle3 triangle = new Areas.Triangle3( new Vector3(10.0f, 10.0f, 15.0f), new Vector3(20.0f, 10.0f, 15.0f), new Vector3(15.0f, 20.0f, 15.0f) ); LineContacts contacts = new Line3( new Vector3(15.0f, 15.0f, 0.0f), Vector3.Backward ).FindContacts(triangle); Assert.AreEqual( 15.0f, contacts.EntryTime, "Direct orthogonal contact to triangle detected" ); contacts = new Line3( new Vector3(15.0f, 15.0f, 30.0f), -Vector3.Backward ).FindContacts(triangle); Assert.AreEqual( 15.0f, contacts.EntryTime, "Direct orthogonal contact to triangle backside detected" ); }
public void TestFindSideContactsOnTriangle() { Areas.Triangle3 triangle = new Areas.Triangle3( new Vector3(10.0f, 10.0f, 15.0f), new Vector3(20.0f, 10.0f, 15.0f), new Vector3(15.0f, 20.0f, 15.0f) ); LineContacts contacts = new Segment3( new Vector3(15.0f, 5.0f, 0.0f), new Vector3(15.0f, 5.0f, 30.0f) ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side A->B miss of triangle plane correctly filtered out" ); contacts = new Segment3( new Vector3(10.0f, 15.0f, 0.0f), new Vector3(10.0f, 15.0f, 30.0f) ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side A->C miss of triangle plane correctly filtered out" ); contacts = new Segment3( new Vector3(20.0f, 15.0f, 0.0f), new Vector3(20.0f, 15.0f, 30.0f) ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side B->C miss of triangle plane correctly filtered out" ); contacts = new Ray3( new Vector3(15.0f, 15.0f, 15.0f + Specifications.MaximumDeviation), new Vector3(15.0f, 15.0f, 30.0f) ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Close orthogonal miss of triangle at segment beginning correctly filtered out" ); contacts = new Ray3( new Vector3(15.0f, 15.0f, 0.0f), new Vector3(15.0f, 15.0f, 15.0f - Specifications.MaximumDeviation) ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Close orthogonal miss of triangle at segment end correctly filtered out" ); }
public void TestFindSideContactsOnTriangle() { Areas.Triangle3 triangle = new Areas.Triangle3( new Vector3(10.0f, 10.0f, 15.0f), new Vector3(20.0f, 10.0f, 15.0f), new Vector3(15.0f, 20.0f, 15.0f) ); LineContacts contacts = new Line3( new Vector3(15.0f, 15.0f, 0.0f), Vector3.Backward ).FindContacts(triangle); Assert.AreEqual( 15.0f, contacts.EntryTime, "Direct orthogonal contact to triangle detected" ); contacts = new Line3( new Vector3(15.0f, 15.0f, 30.0f), -Vector3.Backward ).FindContacts(triangle); Assert.AreEqual( 15.0f, contacts.EntryTime, "Direct orthogonal contact to triangle backside detected" ); contacts = new Line3( new Vector3(15.0f, 5.0f, 0.0f), Vector3.Backward ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side A->B miss of triangle plane correctly filtered out" ); contacts = new Line3( new Vector3(10.0f, 15.0f, 0.0f), Vector3.Backward ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side A->C miss of triangle plane correctly filtered out" ); contacts = new Line3( new Vector3(20.0f, 15.0f, 0.0f), Vector3.Backward ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side B->C miss of triangle plane correctly filtered out" ); }
public void TestFindSideContactsOnTriangle() { Areas.Triangle3 triangle = new Areas.Triangle3( new Vector3(10.0f, 10.0f, 15.0f), new Vector3(20.0f, 10.0f, 15.0f), new Vector3(15.0f, 20.0f, 15.0f) ); LineContacts contacts = new Segment3( new Vector3(15.0f, 5.0f, 0.0f), new Vector3(15.0f, 5.0f, 30.0f) ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side A->B miss of triangle plane correctly filtered out" ); contacts = new Segment3( new Vector3(10.0f, 15.0f, 0.0f), new Vector3(10.0f, 15.0f, 30.0f) ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side A->C miss of triangle plane correctly filtered out" ); contacts = new Segment3( new Vector3(20.0f, 15.0f, 0.0f), new Vector3(20.0f, 15.0f, 30.0f) ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side B->C miss of triangle plane correctly filtered out" ); contacts = new Ray3( new Vector3(15.0f, 15.0f, 15.0f + Specifications.MaximumDeviation), new Vector3(15.0f, 15.0f, 30.0f) ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Close orthogonal miss of triangle at segment beginning correctly filtered out" ); contacts = new Ray3( new Vector3(15.0f, 15.0f, 0.0f), new Vector3(15.0f, 15.0f, 15.0f - Specifications.MaximumDeviation) ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Close orthogonal miss of triangle at segment end correctly filtered out" ); }
public void TestFindOrthogonalContactsOnTriangle() { Areas.Triangle3 triangle = new Areas.Triangle3( new Vector3(10.0f, 10.0f, 15.0f), new Vector3(20.0f, 10.0f, 15.0f), new Vector3(15.0f, 20.0f, 15.0f) ); LineContacts contacts = new Segment3( new Vector3(15.0f, 15.0f, 0.0f), new Vector3(15.0f, 15.0f, 30.0f) ).FindContacts(triangle); Assert.AreEqual( 0.5f, contacts.EntryTime, "Direct orthogonal contact to triangle detected" ); contacts = new Segment3( new Vector3(15.0f, 15.0f, 30.0f), new Vector3(15.0f, 15.0f, 0.0f) ).FindContacts(triangle); Assert.AreEqual( 0.5f, contacts.EntryTime, "Direct orthogonal contact to triangle backside detected" ); }
public void TestFindSideContactsOnTriangle() { Areas.Triangle3 triangle = new Areas.Triangle3( new Vector3(10.0f, 10.0f, 15.0f), new Vector3(20.0f, 10.0f, 15.0f), new Vector3(15.0f, 20.0f, 15.0f) ); LineContacts contacts = new Line3( new Vector3(15.0f, 15.0f, 0.0f), Vector3.Backward ).FindContacts(triangle); Assert.AreEqual( 15.0f, contacts.EntryTime, "Direct orthogonal contact to triangle detected" ); contacts = new Line3( new Vector3(15.0f, 15.0f, 30.0f), -Vector3.Backward ).FindContacts(triangle); Assert.AreEqual( 15.0f, contacts.EntryTime, "Direct orthogonal contact to triangle backside detected" ); contacts = new Line3( new Vector3(15.0f, 5.0f, 0.0f), Vector3.Backward ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side A->B miss of triangle plane correctly filtered out" ); contacts = new Line3( new Vector3(10.0f, 15.0f, 0.0f), Vector3.Backward ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side A->C miss of triangle plane correctly filtered out" ); contacts = new Line3( new Vector3(20.0f, 15.0f, 0.0f), Vector3.Backward ).FindContacts(triangle); Assert.IsNaN( contacts.EntryTime, "Side B->C miss of triangle plane correctly filtered out" ); }