Ejemplo n.º 1
0
        public static void Draw(Canvas canv)
        {
            canv.Children.Clear();
            lines.Clear();
            FindMinMaxDepth();

            xVLine = DrawLine(zero, AffineTransforms.RotateXZ(CamX, CamZ, xV), canv, false, Brushes.Blue);
            yVLine = DrawLine(zero, AffineTransforms.RotateXZ(CamX, CamZ, yV), canv, false, Brushes.Red);
            zVLine = DrawLine(zero, AffineTransforms.RotateXZ(CamX, CamZ, zV), canv, false, Brushes.Green);

            foreach (List <int> gr in ModelStorage.flist)
            {
                for (int i = 0; i < gr.Count; i++)
                {
                    Vector3D v1;
                    if (i > 0)
                    {
                        v1 = ModelStorage.vlist[gr[i - 1] - 1];
                    }
                    else
                    {
                        v1 = ModelStorage.vlist[gr[gr.Count - 1] - 1];
                    }
                    Vector3D v2 = ModelStorage.vlist[gr[i] - 1];
                    v1 = AffineTransforms.RotateXZ(CamX, CamZ, v1);
                    v2 = AffineTransforms.RotateXZ(CamX, CamZ, v2);
                    lines.Add(DrawLine(v1, v2, canv, true, Brushes.Black));
                }
            }
        }
Ejemplo n.º 2
0
        public static void Update(Canvas canv)
        {
            if (ModelStorage.vlist != null)
            {
                FindMinMaxDepth();

                UpdateLine(xVLine, zero, AffineTransforms.RotateXZ(CamX, CamZ, xV), canv, false, Brushes.Blue);
                UpdateLine(yVLine, zero, AffineTransforms.RotateXZ(CamX, CamZ, yV), canv, false, Brushes.Red);
                UpdateLine(zVLine, zero, AffineTransforms.RotateXZ(CamX, CamZ, zV), canv, false, Brushes.Green);
                int index = 0;
                foreach (List <int> gr in ModelStorage.flist)
                {
                    for (int i = 0; i < gr.Count; i++)
                    {
                        Vector3D v1;
                        if (i > 0)
                        {
                            v1 = ModelStorage.vlist[gr[i - 1] - 1];
                        }
                        else
                        {
                            v1 = ModelStorage.vlist[gr[gr.Count - 1] - 1];
                        }
                        Vector3D v2 = ModelStorage.vlist[gr[i] - 1];
                        v1 = AffineTransforms.RotateXZ(CamX, CamZ, v1);
                        v2 = AffineTransforms.RotateXZ(CamX, CamZ, v2);
                        UpdateLine(lines[index], v1, v2, canv, true, Brushes.Black);
                        index++;
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public static void RotateFigure(double angle, bool X, bool Y, bool Z)
 {
     for (int i = 0; i < vlist.Count; i++)
     {
         if (X)
         {
             vlist[i] = AffineTransforms.RotateX(angle, vlist[i]);
         }
         if (Y)
         {
             vlist[i] = AffineTransforms.RotateY(angle, vlist[i]);
         }
         if (Z)
         {
             vlist[i] = AffineTransforms.RotateZ(angle, vlist[i]);
         }
     }
 }