public string GraphDefualtParabola(int incNumTicksPerSec, int Xmin, int Xmax) { incNumTicksPerSec /= 2; int totalXWidth = Xmax - Xmin; ParabolaCurve mParabola = new ParabolaCurve("Parabola " + mNextParabolaIndex, mWindow.mMainModel.GenerateRandomColor(), mWindow.mMainModel.mGraphPlot); mParabola.mNumTicksPerSec = incNumTicksPerSec; mNextParabolaIndex++; mParabola.a = 1; mParabola.h = 1; mParabola.k = 1; for (int i = 0; i < incNumTicksPerSec * totalXWidth; i++) { float ticks = i * (1.0f / (float)incNumTicksPerSec) + Xmin; System.Windows.Point tempPoint = new System.Windows.Point(ticks, mParabola.a * (Math.Pow(ticks - mParabola.h, 2)) + mParabola.k); mParabola.AddPoint(tempPoint, mWindow.mMainModel.mGraphPlot); } mParabolas.Add(mParabola); return("Parabola " + (mNextParabolaIndex - 1)); }
public void SetCurrentCurveByTitle(string incTitle) { switch (incTitle) { case "Distance": mCurrentSelectedCurve = mDistanceCurve; mWindow.theGraphPlot.EquationText.Text = ""; return; case "Velocity": mCurrentSelectedCurve = mVelocityCurve; mWindow.theGraphPlot.EquationText.Text = ""; return; case "Acceleration": mCurrentSelectedCurve = mAccelerationCurve; mWindow.theGraphPlot.EquationText.Text = ""; return; default: break; } for (int i = 0; i < mLineGraphing.mLines.Count; i++) { LineCurve temp = mLineGraphing.mLines.ElementAt(i) as LineCurve; if (incTitle == temp.Title) { mCurrentSelectedCurve = temp; mLineGraphing.CurrentSelectedLine = temp; mLineGraphing.UpdateEquation(mLineGraphing.CurrentSelectedLine.m, mLineGraphing.CurrentSelectedLine.b); mParabolaCurveSelected = false; mWindow.theGraphPlot.DisplayEquationFormConvertion(mParabolaCurveSelected); return; } } for (int i = 0; i < mParabolaGraphing.mParabolas.Count; i++) { ParabolaCurve temp = mParabolaGraphing.mParabolas.ElementAt(i) as ParabolaCurve; if (incTitle == temp.Title) { mCurrentSelectedCurve = temp; mParabolaGraphing.CurrentSelectedParabola = temp; mParabolaGraphing.UpdateEquation(mParabolaGraphing.CurrentSelectedParabola.a, mParabolaGraphing.CurrentSelectedParabola.h, mParabolaGraphing.CurrentSelectedParabola.k); mParabolaCurveSelected = true; mWindow.theGraphPlot.DisplayEquationFormConvertion(mParabolaCurveSelected); return; } } for (int i = 0; i < mSineGraphing.mSines.Count; i++) { SineCurve temp = mSineGraphing.mSines.ElementAt(i) as SineCurve; if (incTitle == temp.Title) { mCurrentSelectedCurve = temp; mSineGraphing.CurrentSelectedSine = temp; mSineGraphing.UpdateEquation(mSineGraphing.CurrentSelectedSine.a, mSineGraphing.CurrentSelectedSine.w, mSineGraphing.CurrentSelectedSine.o, mSineGraphing.CurrentSelectedSine.d); mParabolaCurveSelected = false; mWindow.theGraphPlot.DisplayEquationFormConvertion(mParabolaCurveSelected); return; } } }