private void AddHarmonicYCoordinate(IHarmonicPresentation harmonic) { for (int i = 0; i < COORDINATE_AMOUNT; i++) { _harmonicChartCoordinate [i, 1] += Math.Round(GetYValue(_harmonicChartCoordinate [i, 0], harmonic), 5); } }
private void SetHarmonicPropertiesToView(IHarmonicPresentation harmonic) { amplitudeTextBox.Text = harmonic.GetAmplitude().ToString(); frequencyTextBox.Text = harmonic.GetFrequency().ToString(); phaseTextBox.Text = harmonic.GetPhase().ToString(); sinRadioButton.Checked = harmonic.GetHarmonicKind() == HarmonicKind.Sin ? true : false; cosRadioButton.Checked = harmonic.GetHarmonicKind() == HarmonicKind.Cos ? true : false; }
public AddingHarmonicsView(IHarmonicPresentation harmonicPresentation, IAddingHarmonicController addingNewHarmonicController) { InitializeComponent(); _addingHarmonicController = addingNewHarmonicController; _harmonicPresentation = harmonicPresentation; FillPropertiesDefaultValue(_harmonicPresentation); HarmonicPropertiesChanged(); }
private double GetYValue(double xValue, IHarmonicPresentation harmonicPresentation) { var amplitude = harmonicPresentation.GetAmplitude(); var frequency = harmonicPresentation.GetFrequency(); var phase = harmonicPresentation.GetPhase(); return(harmonicPresentation.GetHarmonicKind() == HarmonicKind.Sin ? amplitude * Math.Sin(frequency * xValue + phase) : amplitude *Math.Cos(frequency *xValue + phase)); }
private void FillPropertiesDefaultValue(IHarmonicPresentation harmonicPresentation) { amplitudeTextBox.Text = harmonicPresentation.GetAmplitude().ToString(); frequencyTextBox.Text = harmonicPresentation.GetFrequency().ToString(); phaseTextBox.Text = harmonicPresentation.GetPhase().ToString(); if (harmonicPresentation.GetHarmonicKind() == HarmonicKind.Sin) { sinRadioButton.Checked = true; } else { cosRadioButton.Checked = true; } }
public static string ConvertHarmonicToStr(IHarmonicPresentation harmonic) { return($"{harmonic.GetAmplitude()}*{harmonic.GetHarmonicKind().ToString()}({harmonic.GetFrequency()}*x+{harmonic.GetPhase()})"); }