public void TestLineLineDistance() { Vector3 startA = new Vector3(0, 0, 0); Vector3 endA = new Vector3(1, 0, 0); Vector3 startB = new Vector3(0, 2, 0); Vector3 endB = new Vector3(1, 1, 0); double t; double s; double distance = GeometryMath.LineLineDistance(startA, endA, startB, endB, true, true, out t, out s); // Check that ray hits AABB (ray starts inside the bounds) Assert.IsTrue(distance == 1, String.Format("Expected distance to be 1 but got {0}, t {1} s {2} (lines cross but testing against segments)", distance, t, s)); }