Пример #1
0
        public void LongIntersectionsSequence() {
            builder = Builder.CreateSimple();
            var a = Param("A");
            var b = Param("B");
            var c = Param("C");
            var x = Param("X");
            var y = Param("Y");
            var r = Param("R");

            var center = new Point(x, y);
            var line = new Line(builder, a, b, c);
            const int iterations = 42;
            for(int i = 0; i < iterations; i++) {
                center = builder.IntersectLineAndCircle(line, new Circle(builder, center.X, center.Y, r)).Item1;
            }
            Assert.IsFalse(center.X.IsNormal());
            Assert.IsFalse(center.Y.IsNormal());
            var context = ImmutableContext.Empty
                .RegisterValue(a, -3.0d / 4.0d)
                .RegisterValue(b, 1)
                .RegisterValue(c, -2)
                .RegisterValue(x, 4)
                .RegisterValue(y, 5)
                .RegisterValue(r, 25);
            Assert.AreEqual(new RealPoint(4 + iterations * 4, 5 + iterations * 3), center.ToRealPoint(context));
        }