Exemplo n.º 1
0
        private void DrawPlanPosition(ref MechanismAnalys.PlanPositionParameters mechanism)
        {
            this.A.Margin  = new Thickness(X_center + MechanismAnalys.X_A * score - 5, Y_center - MechanismAnalys.Y_A * score - 5, 0, 0);
            this.B.Margin  = new Thickness(X_center + mechanism.X_Bn * score - 5, Y_center - mechanism.Y_Bn * score - 5, 0, 0);
            this.S2.Margin = new Thickness(X_center + mechanism.X_S2n * score - 3, Y_center - mechanism.Y_S2n * score - 3, 0, 0);
            this.C.Margin  = new Thickness(X_center + mechanism.X_Cn * score - 5, Y_center - mechanism.Y_Cn * score - 5, 0, 0);
            this.S3.Margin = new Thickness(X_center + mechanism.X_S3n * score - 3, Y_center - mechanism.Y_S3n * score - 3, 0, 0);
            this.D.Margin  = new Thickness(X_center + MechanismAnalys.X_D * score - 5, Y_center - MechanismAnalys.Y_D * score - 5, 0, 0);
            this.S4.Margin = new Thickness(X_center + mechanism.X_S4n * score - 3, Y_center - mechanism.Y_S4n * score - 3, 0, 0);
            this.LineAB.X1 = X_center + MechanismAnalys.X_A * score;
            this.LineAB.Y1 = Y_center - MechanismAnalys.Y_A * score;
            this.LineAB.X2 = X_center + mechanism.X_Bn * score;
            this.LineAB.Y2 = Y_center - mechanism.Y_Bn * score;
            this.LineBC.X1 = X_center + mechanism.X_Bn * score;
            this.LineBC.Y1 = Y_center - mechanism.Y_Bn * score;
            this.LineBC.X2 = X_center + mechanism.X_Cn * score;
            this.LineBC.Y2 = Y_center - mechanism.Y_Cn * score;
            this.LineCD.X1 = X_center + mechanism.X_Cn * score;
            this.LineCD.Y1 = Y_center - mechanism.Y_Cn * score;
            this.LineCD.X2 = X_center + MechanismAnalys.X_D * score;
            this.LineCD.Y2 = Y_center - MechanismAnalys.Y_D * score;


            if (MechanismAnalys.IsAdditionalPoint)
            {
                this.LineBE.X1 = X_center + mechanism.X_Bn * score;
                this.LineBE.Y1 = Y_center - mechanism.Y_Bn * score;
                this.LineBE.X2 = X_center + mechanism.X_En * score;
                this.LineBE.Y2 = Y_center - mechanism.Y_En * score;
                this.E.Margin  = new Thickness(X_center + mechanism.X_En * score - 5, Y_center - mechanism.Y_En * score - 5, 0, 0);
            }
        }
        public void Render(ref MechanismAnalys mechanism, int n)
        {
            MechanismAnalys.PlanPositionParameters plan = new MechanismAnalys.PlanPositionParameters();
            mechanism.CalculationPlanPosition(ref plan, n);
            GeometryGroup res   = new GeometryGroup();
            Point         start = new Point(Xcenter, Ycenter);
            Point         end   = new Point(plan.X_Bn * Score + Xcenter, Ycenter - plan.Y_Bn * Score);

            //res.Children.Add(new LineGeometry(new Point(Xcenter, Ycenter), new Point(plan.X_Bn * Score + Xcenter, Ycenter - plan.Y_Bn * Score)));
            res.Children.Add(new LineGeometry(start, end));

            this.PathPlanePosition.Data = res;
        }
Exemplo n.º 3
0
 private void visible_coordinates(ref MechanismAnalys.PlanPositionParameters mechanism)
 {
     this.LabelA.Content  = "A(" + Convert.ToString(Math.Round(MechanismAnalys.X_A, 4)) + " ; " + Convert.ToString(Math.Round(MechanismAnalys.Y_A, 4)) + ")";
     this.LabelA.Margin   = new Thickness(X_center + MechanismAnalys.X_A * score + 5, Y_center - MechanismAnalys.Y_A * score + 4, 0, 0);
     this.LabelB.Content  = "B(" + Convert.ToString(Math.Round(mechanism.X_Bn, 4)) + " ; " + Convert.ToString(Math.Round(mechanism.Y_Bn, 4)) + ")";
     this.LabelB.Margin   = new Thickness(X_center + mechanism.X_Bn * score + 5, Y_center - mechanism.Y_Bn * score + 4, 0, 0);
     this.LabelS2.Content = "S2(" + Convert.ToString(Math.Round(mechanism.X_S2n, 4)) + " ; " + Convert.ToString(Math.Round(mechanism.Y_S2n, 4)) + ")";
     this.LabelS2.Margin  = new Thickness(X_center + mechanism.X_S2n * score + 5, Y_center - mechanism.Y_S2n * score + 4, 0, 0);
     this.LabelC.Content  = "C(" + Convert.ToString(Math.Round(mechanism.X_S2n, 4)) + " ; " + Convert.ToString(Math.Round(mechanism.Y_Cn, 4)) + ")";
     this.LabelC.Margin   = new Thickness(X_center + mechanism.X_Cn * score + 5, Y_center - mechanism.Y_Cn * score + 4, 0, 0);
     this.LabelS3.Content = "S3(" + Convert.ToString(Math.Round(mechanism.X_S3n, 4)) + " ; " + Convert.ToString(Math.Round(mechanism.Y_S3n, 4)) + ")";
     this.LabelS3.Margin  = new Thickness(X_center + mechanism.X_S3n * score + 5, Y_center - mechanism.Y_S3n * score + 4, 0, 0);
     this.LabelD.Content  = "D(" + Convert.ToString(Math.Round(MechanismAnalys.X_D, 4)) + " ; " + Convert.ToString(Math.Round(MechanismAnalys.Y_D, 4)) + ")";
     this.LabelD.Margin   = new Thickness(X_center + MechanismAnalys.X_D * score + 5, Y_center - MechanismAnalys.Y_D * score + 4, 0, 0);
     this.LabelS4.Content = "S4(" + Convert.ToString(Math.Round(mechanism.X_S4n, 4)) + " ; " + Convert.ToString(Math.Round(mechanism.Y_S4n, 4)) + ")";
     this.LabelS4.Margin  = new Thickness(X_center + mechanism.X_S4n * score + 5, Y_center - mechanism.Y_S4n * score + 4, 0, 0);
 }
Exemplo n.º 4
0
 private void VisibleParameters(ref MechanismAnalys mechanism, ref MechanismAnalys.PlanPositionParameters plan)
 {
     this.LabelNumberPosition.Content = "Положення " + Convert.ToString(n);
     this.LabelOmega.Content          = "Кутова швидкість  " + Convert.ToString(MechanismAnalys.Omega * MechanismAnalys.OmegaDirection) + " рад/с";
     this.LabelV_B.Content            = "Швидкість точки В: " + Convert.ToString(Math.Round(mechanism.v_Bn, 4)) + " м/с";
     this.LabelV_C.Content            = "Швидкість точки C: " + Convert.ToString(Math.Round(mechanism.v_Cn, 4)) + " м/с";
     this.LabelV_S2.Content           = "Швидкість точки S2: " + Convert.ToString(Math.Round(mechanism.v_S2n, 4)) + " м/с";
     this.LabelV_S3.Content           = "Швидкість точки S3: " + Convert.ToString(Math.Round(mechanism.v_S3n, 4)) + " м/с";
     this.LabelV_S4.Content           = "Швидкість точки S4: " + Convert.ToString(Math.Round(mechanism.v_S4n, 4)) + " м/с";
     this.labelFi2n.Content           = "Кут ланки 2: " + Convert.ToString(Math.Round(mechanism.fi_2n, 4)) + " рад";
     this.labelFi3n.Content           = "Кут ланки 3: " + Convert.ToString(Math.Round(mechanism.fi_3n, 4)) + " рад";
     this.labelFi4n.Content           = "Кут ланки 4: " + Convert.ToString(Math.Round(mechanism.fi_4n, 4)) + " рад";
     if (checkBoxVisibleCoordinats.IsChecked.Value)
     {
         visible_coordinates(ref plan);
     }
 }
Exemplo n.º 5
0
        private void OnTimer(object obj, EventArgs e)
        {
            //MechanismAnalys m = App.MechanismResult[n];
h:
            if (n < MechanismAnalys.QuantIteration)
            {
                MechanismAnalys.PlanPositionParameters l = new MechanismAnalys.PlanPositionParameters();
                App.MechanismResult[n].CalculationPlanPosition(ref l, n);
                DrawPlanPosition(ref l);



                VisibleParameters(ref App.MechanismResult[n], ref l);
                n++;
            }
            else
            {
                n = 0;
                goto h;
            };
        }
Exemplo n.º 6
0
        public void StartAnimation()
        {
            coef_omega            = 10;
            labelCoefTime.Content = "Масштабний коефіцієнт часу: " + coef_omega.ToString();
            timer          = new System.Windows.Threading.DispatcherTimer();
            timer.Tick    += OnTimer;
            timer.Interval = TimeSpan.FromSeconds(MechanismAnalys.Omega / (coef_omega * MechanismAnalys.QuantIteration));
            timer.Start();
            InitialMechanismRendering();
            MechanismAnalys.PlanPositionParameters[] l = new MechanismAnalys.PlanPositionParameters[MechanismAnalys.QuantIteration];
            for (int n = 0; n < MechanismAnalys.QuantIteration; n++)
            {
                App.MechanismResult[n].CalculationPlanPosition(ref l[n], n);
            }
            GeometryGroup g = new GeometryGroup();

            DrawTraectory(ref l, ref g, MechanismAnalys.NumberPoints.B);
            PathPlanePosition.Data = g;
            DrawTraectory(ref l, ref g, MechanismAnalys.NumberPoints.C);
            PathPlanePosition.Data = g;
            DrawTraectory(ref l, ref g, MechanismAnalys.NumberPoints.E);
            PathPlanePosition.Data = g;
        }
 public static void Render(ref MechanismAnalys mechanism, int n, ref GeometryGroup res)
 {
     MechanismAnalys.PlanPositionParameters plan = new MechanismAnalys.PlanPositionParameters();
     mechanism.CalculationPlanPosition(ref plan, n);
     res.Children.Add(new LineGeometry(new Point(Xcenter, Ycenter), new Point(plan.X_Bn * Score + Xcenter, Ycenter - plan.Y_Bn * Score)));
 }