public static void Calculation(object obj, DoWorkEventArgs e) { if ((NumberPosition >= QuantPosition) && IsCyclingMotion) { NumberPosition = 0; } else if (NumberPosition >= QuantPosition) { NumberPosition = QuantPosition - 1; } ; DrawingMechanism res = new DrawingMechanism(); res.ResultGeometry = new GeometryGroup(); res.ResultGeometry.FillRule = FillRule.Nonzero; MechanismAnalys.PlanPositionParameters mechanism = new MechanismAnalys.PlanPositionParameters; DrawingMechanism.mechanism = plan_position[NumberPosition]; A = new Point(X_center + MechanismAnalys.X_A * Score, Y_center - MechanismAnalys.Y_A * Score); B = new Point(X_center + mechanism.X_Bn * Score, Y_center - mechanism.Y_Bn * Score); C = new Point(X_center + mechanism.X_Cn * Score, Y_center - mechanism.Y_Cn * Score); D = new Point(X_center + MechanismAnalys.X_D * Score, Y_center - MechanismAnalys.Y_D * Score); res.lineAB = new LineGeometry(A, B); res.lineBC = new LineGeometry(B, C); res.lineCD = new LineGeometry(C, D); res.ellipseA = new EllipseGeometry(A, 3, 3); res.ellipseB = new EllipseGeometry(B, 3, 3); res.ellipseC = new EllipseGeometry(C, 3, 3); res.ellipseD = new EllipseGeometry(D, 3, 3); res.ellipseA = new EllipseGeometry(A, 3, 3); res.ellipseA = new EllipseGeometry(A, 3, 3); double endX = 0; double endY = 0; res.ResultGeometry.Children.Add(res.lineAB); res.ResultGeometry.Children.Add(res.lineBC); res.ResultGeometry.Children.Add(res.lineCD); res.ResultGeometry.Children.Add(res.ellipseA); res.ResultGeometry.Children.Add(res.ellipseB); res.ResultGeometry.Children.Add(res.ellipseC); res.ResultGeometry.Children.Add(res.ellipseD); if (IsVisibleVectorVelocity) { OperatorFunction.F2(B.X, B.Y, LengthVectorVelocity, mechanism.alpha_2n, ref endX, ref endY); res.alpha_2n = new LineGeometry(B, new Point(endX, endY)); OperatorFunction.F2(C.X, C.Y, LengthVectorVelocity, mechanism.alpha_3n, ref endX, ref endY); res.alpha_4n = new LineGeometry(B, new Point(endX, endY)); res.ResultGeometry.Children.Add(res.alpha_2n); res.ResultGeometry.Children.Add(res.alpha_4n); } e.Result = res; NumberPosition++; }
public static void CalculationPlanPosition() { for (int n = 0; n < MechanismAnalys.QuantIteration; n++) { plan_position[n] = new MechanismAnalys(); MechanismAnalys.CalculationPlanPosition(ref plan_position[n], n); MechanismAnalys.CalculationPlanVelocity(ref plan_position[n]); } ; }
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; }
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); } }
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))); }