public void SetOriginLeaveMatrix()
        {
            var point1  = new Vector2(10, 10);
            var point2  = new Vector2(10, 90);
            var point3  = new Vector2(50, 50);
            var origin  = new Vector2(-50, -100);
            var builder = new ShapeBuilder(Matrix3x2.CreateScale(10));

            builder.AddLines(point1, point2, point3);
            builder.SetOrigin(origin);
            builder.StartFigure();
            builder.AddLines(point1, point2, point3);
            var shape = builder.Build().Paths;

            Assert.Equal(100, shape[0].Bounds.Left);
            Assert.Equal(50, shape[1].Bounds.Left);
        }
        public void SetTransform()
        {
            var point1  = new Vector2(10, 10);
            var point2  = new Vector2(10, 90);
            var point3  = new Vector2(50, 50);
            var matrix  = Matrix3x2.CreateTranslation(new Vector2(100, 100));
            var builder = new ShapeBuilder();

            builder.AddLines(point1, point2, point3);
            builder.SetTransform(matrix);
            builder.StartFigure();
            builder.AddLines(point1, point2, point3);
            builder.StartFigure();
            builder.ResetOrigin();
            builder.AddLines(point1, point2, point3);

            var shape = builder.Build().Paths;

            Assert.Equal(10, shape[0].Bounds.Left);
            Assert.Equal(110, shape[1].Bounds.Left);
            Assert.Equal(10, shape[0].Bounds.Left);
        }
        public void DefaultTransform()
        {
            var point1  = new Vector2(10, 10);
            var point2  = new Vector2(10, 90);
            var point3  = new Vector2(50, 50);
            var matrix  = Matrix3x2.CreateTranslation(new Vector2(5, 5));
            var builder = new ShapeBuilder(matrix);

            builder.AddLines(point1, point2, point3);
            var shape = builder.Build();

            Assert.Equal(15, shape.Bounds.Left);
        }
        public void EnumerableAddLines()
        {
            var point1  = new Vector2(10, 10);
            var point2  = new Vector2(10, 90);
            var point3  = new Vector2(50, 50);
            var builder = new ShapeBuilder();

            builder.AddLines(new List <Vector2> {
                point1, point2, point3
            });
            var shape = builder.Build();

            Assert.Equal(10, shape.Bounds.Left);
        }
        public void MultipleStartFiguresDoesntCreateEmptyPaths()
        {
            var point1  = new Vector2(10, 10);
            var point2  = new Vector2(10, 90);
            var point3  = new Vector2(50, 50);
            var builder = new ShapeBuilder();

            builder.StartFigure();
            builder.StartFigure();
            builder.StartFigure();
            builder.StartFigure();
            builder.AddLines(new List <Vector2> {
                point1, point2, point3
            });
            var shape = builder.Build();

            Assert.Equal(1, shape.Paths.Length);
        }