コード例 #1
0
        private Point_3D PovorotX(Point_3D old)
        {
            Point_3D tmp = new Point_3D();

            tmp.X = old.X;
            tmp.Y = old.Y * Math.Cos(a) - old.Z * Math.Sin(a);
            tmp.Z = old.Y * Math.Sin(a) + old.Z * Math.Cos(a);
            return(tmp);
        }
コード例 #2
0
        private Point_3D PovorotY(Point_3D old)
        {
            Point_3D tmp = new Point_3D();

            tmp.X = old.X * Math.Cos(b) + old.Z * Math.Sin(b);
            tmp.Y = old.Y;
            tmp.Z = -old.X * Math.Sin(b) + old.Z * Math.Cos(b);
            return(tmp);
        }
コード例 #3
0
        private Point_3D CalcCoord(double a, double b)
        {
            Point_3D tmp = new Point_3D();

            tmp.X = r * a;
            tmp.Y = r * b;
            tmp.Z = r * k * a * b / (Math.Pow(a, 2) + Math.Pow(b, 2));
            return(tmp);
        }
コード例 #4
0
        // Первод в аксонометрические координаты.
        private Point_3D CalcCoordAx(Point_3D old, double f, double q)
        {
            Point_3D tmp = new Point_3D();

            tmp.X = old.X * Math.Cos(f) + old.Y * Math.Sin(f);
            tmp.Y = -old.X * Math.Sin(f) * Math.Cos(q) + old.Y * Math.Cos(f) * Math.Cos(q) + old.Z * Math.Sin(q);
            tmp.Z = old.X * Math.Sin(f) * Math.Sin(q) - old.Y * Math.Cos(f) * Math.Sin(q) + old.Z * Math.Cos(q);
            return(tmp);
        }
コード例 #5
0
        private Point_3D Peremeshenie(Point_3D old)
        {
            Point_3D tmp = new Point_3D();

            tmp.X = old.X + dx;
            tmp.Y = old.Y + dy;
            tmp.Z = old.Z + dz;
            return(tmp);
        }
コード例 #6
0
        private Point_3D Mashtabirovanie(Point_3D old)
        {
            Point_3D tmp = new Point_3D();

            tmp.X = old.X * kx;
            tmp.Y = old.Y * ky;
            tmp.Z = old.Z * kz;
            return(tmp);
        }
コード例 #7
0
        private Point_3D PovorotZ(Point_3D old)
        {
            Point_3D tmp = new Point_3D();

            tmp.X = old.X * Math.Cos(g1) - old.Y * Math.Sin(g1);
            tmp.Y = old.X * Math.Sin(g1) + old.Y * Math.Cos(g1);
            tmp.Z = old.Z;
            return(tmp);
        }
コード例 #8
0
        // Перевод в экранные координаты.
        private Point_3D CalcCoordSc(Point_3D old)
        {
            int x = pictureBox2.ClientSize.Width / 2;
            int y = pictureBox2.ClientSize.Height / 2;

            Point_3D tmp = new Point_3D();

            tmp.X = Convert.ToInt32(x + old.X);
            tmp.Y = Convert.ToInt32(y + old.Y);
            return(tmp);
        }
コード例 #9
0
 // Рисование фигуры.
 private void Draw()
 {
     for (int i = 0; i < 39; i++)
     {
         for (int j = 0; j < 39; j++)
         {
             if (j != 39)
             {
                 Point p1 = new Point(screen[i, j].X, screen[i, j].Y);
                 Point p2 = new Point(screen[i, j + 1].X, screen[i, j + 1].Y);
                 g.DrawLine(pen, p1, p2);
             }
             else
             {
                 Point_3D p1 = new Point_3D(screen[i, 16].X, screen[i, 16].Y);
                 Point_3D p2 = new Point_3D(screen[i, 0].X, screen[i, 0].Y);
                 g.DrawLine(pen, p1, p2);
             }
         }
     }
     for (int i = 0; i <= 39; i++)
     {
         for (int j = 0; j <= 39; j++)
         {
             if (i != 39)
             {
                 Point_3D p1 = new Point_3D(screen[i, j].X, screen[i, j].Y);
                 Point_3D p2 = new Point_3D(screen[i + 1, j].X, screen[i + 1, j].Y);
                 g.DrawLine(pen, p1, p2);
             }
             else
             {
                 Point_3D p1 = new Point_3D(screen[i, j].X, screen[i, j].Y);
                 Point_3D p2 = new Point_3D(screen[i, j].X + 1, screen[i, j].Y + 1);
                 g.DrawLine(pen, p1, p2);
             }
         }
     }
 }