public ToolPath CreateToolPath(PathData pd, double inc) { ToolPath tp; WheelsData rd = (WheelsData)pd; tp = new ToolPath(CalculateWheels(rd, inc)); return(tp); }
/// <summary> /// Initialise a current truck object /// </summary> public Current() { MotorValues = new Motor(); DashboardValues = new Dashboard(); LightsValues = new Lights(); WheelsValues = new WheelsData(); DamageValues = new Damage(); PositionValue = new DPlacement(); AccelerationValues = new Acceleration(); }
private PointCollection CalculateWheels(WheelsData CurrentData, double inc) { PointCollection pts = new PointCollection(); var maxAngle = CurrentData.SuggestedMaxTurns * 2 * Math.PI; for (double t = 0; t < maxAngle; t += inc) { Complex c = new Complex(); foreach (WheelStageData sd in CurrentData.Stages) { c += sd.Amplitude * Complex.Exp(new Complex(0,sd.Frequency * t )); } pts.Add(new Point(c.Real, c.Imaginary)); } return pts; }
private PointCollection CalculateWheels(WheelsData CurrentData, double inc) { PointCollection pts = new PointCollection(); var maxAngle = CurrentData.SuggestedMaxTurns * 2 * Math.PI; for (double t = 0; t < maxAngle; t += inc) { Complex c = new Complex(); foreach (WheelStageData sd in CurrentData.Stages) { c += sd.Amplitude * Complex.Exp(new Complex(0, sd.Frequency * t)); } pts.Add(new Point(c.Real, c.Imaginary)); } return(pts); }
Windows.UI.Xaml.Shapes.Polygon Path(PathData pd, double inc) { CompositeTransform ct = new CompositeTransform(); ct.ScaleX = ct.ScaleY = 1; Windows.UI.Xaml.Shapes.Polygon p = new Windows.UI.Xaml.Shapes.Polygon(); p.Stroke = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)); p.RenderTransform = ct; if (!(pd is WheelsData)) { return(p); } WheelsData rd = (WheelsData)pd; p.Points = CalculateWheels(rd, inc); // now centre polygon //CentrePolygon(ref p); return(p); }