Ejemplo n.º 1
0
        //Строим винтовую лестницу
        private void DrawWireframeDrill()
        {
            Gl.glColor3f(0, 0, 0);
            Gl.glLineWidth(1);

            MyRotate rotate  = new MyRotate();
            MyPoint  tPoint  = new MyPoint();
            MyPoint  tPoint2 = new MyPoint();


            MyPoint[] arr1;// = new MyPoint[64];
            // SetupArray(arr1);


            MyPoint[] arr2 = new MyPoint[64];
            SetupArray(arr2);

            //   O = Math.PI * 1 / 180;

            double h, dH, H, tH, t2H, L2, dL;
            int    i, j;
            int    Q = (int)(O * 180 / Math.PI + 5);


            h  = R / Math.Tan(O);
            H  = array[act_quant / 2].Y;
            dH = (2 * H) / (Q - 1);

            t2H = -H;
            L2  = t2H / h;
            rotate.SetRotate(L2, 0, 0, 1);
            for (j = 0; j < act_quant; j++)
            {
                rotate.TransformPoint(arraySV[j], arr2[j]);
            }

            dL = Math.Atan(arraySV[0].Y / arraySV[0].X);
            dL = (Math.PI - dL) * 2 / (12 - 1);

            for (i = 0; i < Q; i++)
            {
                tH  = t2H;
                t2H = -H + (i + 1) * dH;

                L2 = t2H / h;
                //  CopyArray(arr1, arr2);
                arr1 = arr2.Select(o => o.Clone()).ToArray();
                rotate.SetRotate(L2, 0, 0, 1);
                for (j = 0; j < act_quant; j++)
                {
                    rotate.TransformPoint(arraySV[j], arr2[j]);
                }

                Gl.glBegin(Gl.GL_LINE_STRIP);
                for (j = 0; j < act_quant; j++)
                {
                    Gl.glVertex3d(arr1[j].X, arr1[j].Y, tH);
                }
                Gl.glEnd();

                Gl.glBegin(Gl.GL_LINE_STRIP);
                for (j = 0; j < 12; j++)
                {
                    rotate.SetRotate(dL * j, 0, 0, 1);
                    rotate.TransformPoint(arr1[0], tPoint);
                    Gl.glVertex3d(tPoint.X, tPoint.Y, tH);
                }
                Gl.glEnd();

                if (i < (Q - 1))
                {
                    Gl.glBegin(Gl.GL_LINES);
                    for (j = 0; j < act_quant; j++)
                    {
                        Gl.glVertex3d(arr1[j].X, arr1[j].Y, tH);
                        Gl.glVertex3d(arr2[j].X, arr2[j].Y, t2H);
                    }
                    Gl.glEnd();

                    Gl.glBegin(Gl.GL_LINES);
                    for (j = 0; j < 12; j++)
                    {
                        rotate.SetRotate(dL * j, 0, 0, 1);
                        rotate.TransformPoint(arr1[0], tPoint);
                        rotate.TransformPoint(arr2[0], tPoint2);
                        Gl.glVertex3d(tPoint.X, tPoint.Y, tH);
                        Gl.glVertex3d(tPoint2.X, tPoint2.Y, t2H);
                    }
                    Gl.glEnd();
                }
            }
        }