Esempio n. 1
0
            static Shape <double> CreatePathShape(ConvolutionFactory factory)
            {
                var pathSegment = factory.CreateSegment(
                    startX: 0.0, startY: 0.0,
                    endX: 1.0, endY: 2.0,
                    weight: 1);

                var pathReverseSegment = factory.CreateSegment(
                    startX: 1.0, startY: 2.0,
                    endX: 0.0, endY: 0.0,
                    weight: 1);

                var smoothingArc1 = factory.CreateArc(
                    pathSegment.Start,
                    factory.CreateDirectionRange(
                        pathReverseSegment.Direction.NormalDirection().Opposite(),
                        pathSegment.Direction.NormalDirection().Opposite(),
                        Orientation.CounterClockwise),
                    0.0,
                    1);

                var smoothingArc2 = factory.CreateArc(
                    pathReverseSegment.Start,
                    factory.CreateDirectionRange(
                        pathSegment.Direction.NormalDirection().Opposite(),
                        pathReverseSegment.Direction.NormalDirection().Opposite(),
                        Orientation.CounterClockwise),
                    0.0,
                    1);

                return(factory.CreateShape(
                           new Tracing <double>[]
                           { smoothingArc1, pathSegment, smoothingArc2, pathReverseSegment }));
            }
        public void SetUp()
        {
            var calculator = new DoubleAlgebraicNumberCalculator();

            _factory = new ConvolutionFactory <double>(calculator);

            var segment = _factory.CreateSegment(
                startX: 10,
                startY: 5,
                endX: 15,
                endY: 10,
                weight: 4);

            var tracings = new List <Tracing <double> > {
                segment
            };

            _shape1            = new Shape <double>(tracings);
            _shape2            = new Shape <double>(tracings);
            _convolvedTracings = new List <ConvolvedTracing <double> >();
        }
Esempio n. 3
0
        When_calling_ConvolveArcAndSegment_With_two_shapes_without_tangents_Then_the_result_Should_be_empty()
        {
            // Arrange arc1
            var arc = _factory.CreateArc(
                radius: 2.0,
                weight: 3,
                centerX: 1.0,
                centerY: 3.0,
                directionStartX: 2.0,
                directionStartY: 0.0,
                directionEndX: 0.0,
                directionEndY: 5.0,
                orientation: Orientation.CounterClockwise);

            // Arrange segment
            var segment = _factory.CreateSegment(
                startX: 10,
                startY: 5,
                endX: 15,
                endY: 10,
                weight: 4);

            // Act
            var actual = _factory.ConvolveArcAndSegment(arc, segment);

            // Assert
            actual.Should().BeEmpty();
        }