Exemplo n.º 1
0
        public void ComputeReal3D(double[,] operation)
        {
            var childrenCount = children.Count;
            var data          = MakeDataFromLines(childrenCount);

            ComputingMatrix cm = new ComputingMatrix();

            cm.AddData(data);
            cm.AddOperation(operation);
            cm.ComputeMatrix();

            var result = cm.GetResult();

            for (var i = 0; i < childrenCount; ++i)
            {
                var underLine  = children[i] as UnderLine;
                var point1     = coordinate.ToNormalCoordinates(new Point(result[i * 2, 0], result[i * 2, 1]));
                var point2     = coordinate.ToNormalCoordinates(new Point(result[i * 2 + 1, 0], result[i * 2 + 1, 1]));
                var realMatrix = new double[, ]
                {
                    { point1[0], point1[1], result[i * 2, 2], result[i * 2, 3] },
                    { point2[0], point2[1], result[i * 2 + 1, 2], result[i * 2 + 1, 3] }
                };
                underLine.SetRealMatrix(realMatrix);
            }
        }
Exemplo n.º 2
0
        public void ProjectReal3D(double zc)
        {
            var childrenCount = children.Count;
            var data          = MakeDataFromLines(childrenCount);

            var cm = new ComputingMatrix();

            cm.AddData(data);
            cm.AddOperation(new double[, ]
            {
                { 1, 0, 0, 0 },
                { 0, 1, 0, 0 },
                { 0, 0, 0, -1 / zc },
                { 0, 0, 0, 1 }
            });
            cm.ComputeMatrix();

            var result = cm.GetResult();

            for (var i = 0; i < childrenCount; ++i)
            {
                var line      = children[i].Display() as Line;
                var newPoint1 = coordinate.ToNormalCoordinates(new Point(result[i * 2, 0], result[i * 2, 1]));
                var newPoint2 = coordinate.ToNormalCoordinates(new Point(result[i * 2 + 1, 0], result[i * 2 + 1, 1]));

                line.X1 += newPoint1[0] - line.X1;
                line.Y1 += newPoint1[1] - line.Y1;
                line.X2 += newPoint2[0] - line.X2;
                line.Y2 += newPoint2[1] - line.Y2;
            }
        }