public void TouchIntersection1Test() { Vector2 a1 = new Vector2(1, 3); Vector2 a2 = new Vector2(3, 1); Vector2 b1 = new Vector2(2, 2); Vector2 b2 = new Vector2(3, 3); Assert.AreEqual(new Vector2(2, 2), Intersections.LinesegmentLinesegmentIntersection(a1, a2, b1, b2)); }
public void Intersection2Test() { Vector2 a1 = new Vector2(0, 0.5f); Vector2 a2 = new Vector2(0, 2); Vector2 b1 = new Vector2(-1, 1); Vector2 b2 = new Vector2(1, 1); Assert.AreEqual(new Vector2(0, 1), Intersections.LinesegmentLinesegmentIntersection(a1, a2, b1, b2)); }
public void Parallel1Test() { Vector2 a1 = new Vector2(2, 2); Vector2 a2 = new Vector2(1, 3); Vector2 b1 = new Vector2(3, 2); Vector2 b2 = new Vector2(2, 3); Assert.IsTrue(float.IsNaN(Intersections.LinesegmentLinesegmentIntersection(a1, a2, b1, b2).X)); Assert.IsTrue(float.IsNaN(Intersections.LinesegmentLinesegmentIntersection(a1, a2, b1, b2).Y)); }
public void SamelineTest() { Vector2 a1 = new Vector2(0, 0); Vector2 a2 = new Vector2(0, 3); Vector2 b1 = new Vector2(0, 0.5f); Vector2 b2 = new Vector2(0, 0.7f); Assert.IsTrue(float.IsPositiveInfinity(Intersections.LinesegmentLinesegmentIntersection(a1, a2, b1, b2).X)); Assert.IsTrue(float.IsPositiveInfinity(Intersections.LinesegmentLinesegmentIntersection(a1, a2, b1, b2).Y)); }
public void NoIntersection1Test() { Vector2 a1 = new Vector2(0, 0); Vector2 a2 = new Vector2(0, 2); Vector2 b1 = new Vector2(1, 1); Vector2 b2 = new Vector2(2, 1); Assert.IsTrue(float.IsNaN(Intersections.LinesegmentLinesegmentIntersection(a1, a2, b1, b2).X)); Assert.IsTrue(float.IsNaN(Intersections.LinesegmentLinesegmentIntersection(a1, a2, b1, b2).Y)); }