Exemple #1
0
        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));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        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));
        }