Пример #1
0
 private void IncBinding2_Button_Click(object sender, EventArgs e)
 {
     if (TopMount_radioButton.Checked == true)
     {
         if (Object4.Get_Height() + 0.5f < Object2.Get_Height())
         {
             Object4.Set_Height(Object4.Get_Height() + 0.5f);
         }
     }
     else
     {
         if (Object4.Get_Height() - 0.5f > Object1.Get_Height())
         {
             Object4.Set_Height(Object4.Get_Height() - 0.5f);
         }
     }
 }
Пример #2
0
 private void DecLentil1_Button_Click(object sender, EventArgs e)
 {
     if (TopMount_radioButton.Checked == true)
     {
         if (Object1.Get_Height() - 0.5f >= 0)
         {
             Object1.Set_Height(Object1.Get_Height() - 0.5f);
         }
     }
     else
     {
         if (Object1.Get_Height() + 0.5f < Object4.Get_Height())
         {
             Object1.Set_Height(Object1.Get_Height() + 0.5f);
         }
     }
 }
Пример #3
0
 private void RenderTimer_Tick(object sender, EventArgs e)
 {
     DrawAllMatrix();
     AngleValue_Label.Text = Convert.ToString(ChangeAngle_TrackBar.Value) + "°";
     if (TopMount_radioButton.Checked == true)
     {
         label2.Text = Convert.ToString(Object1.Get_Height() / 10) + " м";
         label3.Text = Convert.ToString(Object2.Get_Height() / 10) + " м";
         label4.Text = Convert.ToString(Object3.Get_Height() / 10) + " м";
         label5.Text = Convert.ToString(Object4.Get_Height() / 10) + " м";
     }
     else
     {
         label2.Text = Convert.ToString(1 - Object1.Get_Height() / 10) + " м";
         label3.Text = Convert.ToString(1 - Object2.Get_Height() / 10) + " м";
         label4.Text = Convert.ToString(1 - Object3.Get_Height() / 10) + " м";
         label5.Text = Convert.ToString(1 - Object4.Get_Height() / 10) + " м";
     }
 }
Пример #4
0
        private double f(double xt, double yt, double zt)
        {
            if (TopMount_radioButton.Checked == true)
            {
                float o1 = Object1.Get_Height() / 10;
                float o2 = Object2.Get_Height() / 10;
                float o3 = Object3.Get_Height() / 10;
                float o4 = Object4.Get_Height() / 10;

                L = o3 - (o1 + o2) / 2;
                I = 2 * 0.08 * 0.08 + M * Math.Pow((o1 - o3), 2) + M * Math.Pow((o2 - o3), 2);
                return(-G *M *L *Math.Sin(yt) / I);
            }
            else
            {
                float o1 = 1 - Object1.Get_Height() / 10;
                float o2 = 1 - Object2.Get_Height() / 10;
                float o3 = 1 - Object3.Get_Height() / 10;
                float o4 = 1 - Object4.Get_Height() / 10;
                L = o4 - (o1 + o2) / 2;
                I = 2 * 0.08 * 0.08 + Math.Pow((o1 - o4), 2) + Math.Pow((o2 - o4), 2);
                return(-G *L *Math.Sin(yt) / I);
            }
        }
Пример #5
0
        private void DrawAllMatrix()
        {
            if (Correct_Height != AnT.Size.Height || Correct_Width != AnT.Size.Width)
            {
                if (Correct_Height != AnT.Size.Height)
                {
                    Correct_Height = AnT.Size.Height;
                }
                if (Correct_Width != AnT.Size.Width)
                {
                    Correct_Width = AnT.Size.Width;
                }
                Gl.glViewport(0, 0, AnT.Width, AnT.Height);
            }

            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Glu.gluPerspective(45, (float)AnT.Width / (float)AnT.Height, 0.1, 200);
            Gl.glMatrixMode(Gl.GL_MODELVIEW);

            Gl.glClearColor(0.7f * 1.2f, 0.999f * 1.2f, 0.568f * 1.2f, 1.0f);//фон редактить здесь
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);

            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Gl.glEnable(Gl.GL_LIGHTING);
            Gl.glEnable(Gl.GL_LIGHT0);
            Gl.glEnable(Gl.GL_COLOR_MATERIAL);

            Gl.glColor3d(0.31, 0.31, 0.31);
            Gl.glRotated(-90, 1, 0, 0);
            Gl.glRotated(90, 0, 0, 1);

            Shtativ.DrawModel();
            DrawGround();//КАТЯ, СТОЛ УБИРАЕТСЯ ЗДЕСЬ!!!
            Gl.glRotated(-90, 0, 0, 1);
            Gl.glRotated(90, 1, 0, 0);
            Gl.glColor3d(0.31, 0.31, 0.31);
            Gl.glPushMatrix();
            Gl.glRotatef(-90, 1, 0, 0);
            Gl.glTranslatef(0, 0, 1);
            Gl.glRotated(Angle, 0, -1, 0);
            Gl.glTranslatef(0, 0, -1);

            if (TopMount_radioButton.Checked == true)
            {
                Gl.glTranslatef(0, 0, 1 - Object3.Get_Height() / 10);
                Glut.glutSolidCylinder(0.01d, 1, 200, 1);
                Gl.glColor3d(0, 0.0, 0.0);
                for (int i = 1; i < 20; i++)
                {
                    Gl.glTranslatef(0, 0, 0.05f);
                    Glut.glutSolidCylinder(0.0101d, 0.002, 200, 1);
                }
                Gl.glTranslatef(0, 0, -0.95f);
                Gl.glColor3d(0.75, 0, 0);
                Glut.glutSolidCylinder(0.0120d, 0.025, 200, 1);
                Gl.glColor3d(0.31, 0.31, 0.31);
            }
            if (BottomMount_radioButton.Checked == true)
            {
                Gl.glTranslatef(0, 0, 1 + Object4.Get_Height() / 10);
                Gl.glRotatef(-180, 1, 0, 0);
                Glut.glutSolidCylinder(0.01d, 1, 200, 1);
                Gl.glColor3d(0, 0.0, 0.0);
                for (int i = 1; i < 20; i++)
                {
                    Gl.glTranslatef(0, 0, 0.05f);
                    Glut.glutSolidCylinder(0.0101d, 0.002, 200, 1);
                }
                Gl.glColor3d(0.75, 0, 0);
                Gl.glTranslatef(0, 0, 0.025f);
                Glut.glutSolidCylinder(0.0120d, 0.025, 200, 1);
                Gl.glTranslatef(0, 0, -0.975f);
                Gl.glColor3d(0.31, 0.31, 0.31);
            }

            Gl.glColor3d(0.31, 0.31, 0.31);
            Gl.glDisable(Gl.GL_COLOR_MATERIAL);
            Gl.glPushMatrix();


            Object1.Drawobject();
            Object2.Drawobject();
            Object3.Drawobject(false);
            Object4.Drawobject(true);
            Gl.glPopMatrix();
            Gl.glPopMatrix();

            Gl.glDisable(Gl.GL_DEPTH_TEST);
            Gl.glDisable(Gl.GL_LIGHTING);
            Gl.glDisable(Gl.GL_LIGHT0);
            Gl.glLoadIdentity();

            Gl.glRotated(camXRot, 1, 0, 0);
            Gl.glRotated(camYRot, 0, 1, 0);
            Gl.glTranslated(camXPos, camYPos, camZPos);
            Gl.glTranslated(0, -0.5, -2.5);
            Gl.glFlush();//?
            AnT.Invalidate();
        }