예제 #1
0
        void DrawRobot(Graphics gr, PointF startPoint, Class2.Matrix4x4 projectionMatrix)
        {
            //проекция
            var p = new Class2.Vector4[drRobot.Length];

            for (int i = 0; i < drRobot.Length; i++)
            {
                p[i] = projectionMatrix * drRobot[i];
            }
            //создаем путь
            var path = new GraphicsPath();

            AddLine(path, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12]);

            //сдвигаем
            gr.ResetTransform();
            gr.TranslateTransform(startPoint.X, startPoint.Y);
            //рисуем
            Pen myWind = new Pen(Color.Blue, 5);

            gr.DrawPath(myWind, path);

            // gr.DrawLines(myWind, path.PathPoints);

            gr.DrawEllipse(Pens.Black, -3 + (float)p[0].X, -3 + (float)p[0].Y, (float)7, (float)7);
            gr.DrawEllipse(Pens.Black, -3 + (float)p[1].X, -3 + (float)p[1].Y, (float)7, (float)7);
            gr.DrawEllipse(Pens.Black, -3 + (float)p[2].X, -3 + (float)p[2].Y, (float)7, (float)7);
            gr.DrawEllipse(Pens.Black, -3 + (float)p[3].X, -3 + (float)p[3].Y, (float)7, (float)7);
            gr.DrawEllipse(Pens.Black, -3 + (float)p[4].X, -3 + (float)p[4].Y, (float)7, (float)7);
            gr.DrawEllipse(Pens.Black, -3 + (float)p[5].X, -3 + (float)p[5].Y, (float)7, (float)7);
            gr.DrawEllipse(Pens.Black, -3 + (float)p[6].X, -3 + (float)p[6].Y, (float)7, (float)7);
        }
예제 #2
0
        private void pictureBox2_Paint(object sender, PaintEventArgs e)
        {
            //создаем матрицу проекции на плоскость XY
            var paneXY = new Class2.Matrix4x4()
            {
                V00 = 2f, V11 = 2f, V33 = 1f
            };

            //рисуем
            DrawRobot(e.Graphics, new PointF(250, 300), paneXY);
        }