コード例 #1
0
        [TestCase(4, -5, 6, 13.5262794416288, -10.5, 3)]   // No intersection, Translated  and Rotated to quadrant 4
        public static void IntersectionCoordinates_Static_of_Not_Intersecting_Returns_Empty_Array(
            double x1, double y1, double r1,
            double x2, double y2, double r2)
        {
            CircularCurve curve1 = new CircularCurve(r1, new CartesianCoordinate(x1, y1));

            curve1.Tolerance = Tolerance;
            CircularCurve curve2 = new CircularCurve(r2, new CartesianCoordinate(x2, y2));

            curve2.Tolerance = Tolerance;

            CartesianCoordinate[] intersectionCoordinates = IntersectionCircularCircular.IntersectionCoordinates(curve1, curve2);
            Assert.AreEqual(0, intersectionCoordinates.Length);
        }
コード例 #2
0
        [TestCase(4, -5, 6, 13.5262794416288, -10.5, 5, 9.196152, -8)]    // Tangent, Translated and Rotated to quadrant 4
        public static void IntersectionCoordinates_Static_of_Tangents_Returns_Tangent_Coordinate(
            double x1, double y1, double r1,
            double x2, double y2, double r2,
            double x1Expected, double y1Expected)
        {
            CircularCurve curve1 = new CircularCurve(r1, new CartesianCoordinate(x1, y1));

            curve1.Tolerance = Tolerance;
            CircularCurve curve2 = new CircularCurve(r2, new CartesianCoordinate(x2, y2));

            curve2.Tolerance = Tolerance;

            CartesianCoordinate[] intersectionCoordinates = IntersectionCircularCircular.IntersectionCoordinates(curve1, curve2);
            Assert.AreEqual(1, intersectionCoordinates.Length);
            Assert.AreEqual(x1Expected, intersectionCoordinates[0].X, Tolerance);
            Assert.AreEqual(y1Expected, intersectionCoordinates[0].Y, Tolerance);
        }
コード例 #3
0
        [TestCase(4, -5, 6, 13.5262794416288, -10.5, 7, 9.976276, -4.466968, 6.526519, -10.442123)]     // Intersection, Translated and Rotated to quadrant 4
        public static void IntersectionCoordinates(
            double x1, double y1, double r1,
            double x2, double y2, double r2,
            double x1Expected, double y1Expected,
            double x2Expected, double y2Expected)
        {
            CircularCurve curve1 = new CircularCurve(r1, new CartesianCoordinate(x1, y1));

            curve1.Tolerance = Tolerance;
            CircularCurve curve2 = new CircularCurve(r2, new CartesianCoordinate(x2, y2));

            curve2.Tolerance = Tolerance;

            IntersectionCircularCircular intersections = new IntersectionCircularCircular(curve1, curve2);

            CartesianCoordinate[] intersectionCoordinates = intersections.IntersectionCoordinates();

            Assert.AreEqual(x1Expected, intersectionCoordinates[0].X, Tolerance);
            Assert.AreEqual(y1Expected, intersectionCoordinates[0].Y, Tolerance);
            Assert.AreEqual(x2Expected, intersectionCoordinates[1].X, Tolerance);
            Assert.AreEqual(y2Expected, intersectionCoordinates[1].Y, Tolerance);
        }
コード例 #4
0
 /// <summary>
 /// Returns points where the circular curve intersects the provided circular curve.
 /// </summary>
 /// <param name="otherLine">Circular curve that intersects the current circular curve.</param>
 /// <returns>CartesianCoordinate.</returns>
 public CartesianCoordinate[] IntersectionCoordinate(CircularCurve otherLine)
 {
     return(IntersectionCircularCircular.IntersectionCoordinates(this, otherLine));
 }