コード例 #1
0
        [TestCase(1, 1, 4, 3, 9, 5, 12, 7)] // Sloped-Sloped Parallel
        public static void IntersectionCoordinates_Static_of_Collinear_Lines_Returns_Empty_Array(
            double x1, double y1, double x2, double y2,
            double x3, double y3, double x4, double y4)
        {
            LinearCurve curve1 = new LinearCurve(new CartesianCoordinate(x1, y1), new CartesianCoordinate(x2, y2));

            curve1.Tolerance = Tolerance;
            LinearCurve curve2 = new LinearCurve(new CartesianCoordinate(x3, y3), new CartesianCoordinate(x4, y4));

            curve2.Tolerance = Tolerance;

            CartesianCoordinate[] intersectionCoordinates = IntersectionLinearLinear.IntersectionCoordinates(curve1, curve2);
            Assert.AreEqual(0, intersectionCoordinates.Length);
        }
コード例 #2
0
        [TestCase(1, 1, 4, 3, 9, 6, 12, 9, 10, 7)]       // Sloped-Sloped
        public static void IntersectionCoordinates_Static(
            double x1, double y1, double x2, double y2,
            double x3, double y3, double x4, double y4,
            double xExpected, double yExpected)
        {
            LinearCurve curve1 = new LinearCurve(new CartesianCoordinate(x1, y1), new CartesianCoordinate(x2, y2));

            curve1.Tolerance = Tolerance;
            LinearCurve curve2 = new LinearCurve(new CartesianCoordinate(x3, y3), new CartesianCoordinate(x4, y4));

            curve2.Tolerance = Tolerance;

            CartesianCoordinate[] intersectionCoordinates = IntersectionLinearLinear.IntersectionCoordinates(curve1, curve2);

            Assert.AreEqual(xExpected, intersectionCoordinates[0].X, Tolerance);
            Assert.AreEqual(yExpected, intersectionCoordinates[0].Y, Tolerance);
        }