private void CalculatePathInternalAsy(NuGenFormula fml, bool force) { if (fml.draw && (force || _forceFormula == i - 1 || fml.PaintValidate.Start > (double)(-_gitter.X) / w || fml.PaintValidate.End < (double)(this.Width - _gitter.X) / w)) { if (fml.HasChildren) { for (int _i = 0; _i < fml.Children.Count; _i++) { CalculatePathInternalAsy(fml.Children[_i], force); } return; } NuGenInterpreter.SetVariableValue(_vara, fml.Param); fml.pth.Reset(); fml.pthasympt.Reset(); //intptr.WertändernUS(Math.Max(begin/w,fml.intervall.start)); ppy = py = GetVal(fml._ve, Math.Max(begin / w, fml.Interval.Start)) * -h; ///// SaveLine(fml.pthasympt, -2e5f * h, GetValIS(fml._ve, -2e5f) * -h, 2e5f * h, GetValIS(fml._ve, 2e5f) * -h); pcurr = 0; for (d = Math.Max(begin, fml.Interval.Start * w) + 1.0; d <= Math.Min(end, fml.Interval.End * w); d++, pcurr++) { //intptr.WertändernUS(d/w); y = GetVal(fml._ve, d / w) * -h; /////// if (SAsymp(ppy, py, y)) { fml.pthasympt.StartFigure(); fml.pthasympt.AddLine((float)d, 2e5f, (float)d, -2e5f); fml.pth.StartFigure(); } else { fml.pth.AddLine((float)(d - 1.0), py, (float)d, y); } ppy = py; py = y; if (Success != null) { Success( pcurr, pmax, string.Format( Resources.Text_VisiPlot2D_SuccessDescription, i.ToString(CultureInfo.CurrentCulture), _formulas.Count.ToString(CultureInfo.CurrentCulture) ) ); } } fml.PaintValidate = new NuGenPlotInterval(begin / w, end / w); _forceFormula = -1; } }
private NuGenFormula(string formel, NuGenPlotInterval intervall, Color frb, bool draw, NuGenFormula[] children, double param) { _formel = formel; _children = new NuGenFormulaCollectionBase(); if (children != null) { _children.AddRange(children); } this._param = param; this._formulaElement = NuGenInterpreter.ParseInfixExpression(formel); this._interval = intervall; this.frb = frb; this._paintValidate = new NuGenPlotInterval(0.0, 0.0); this.draw = draw; _pth = new GraphicsPath(); _pthasympt = new GraphicsPath(); }
private float GetValIS(NuGenFormulaElement fml, double val) { NuGenInterpreter.SetVariableValue(_varx, val); float res = (float)fml.Value; if (float.IsNaN(res)) { return(0f); } else if (float.IsPositiveInfinity(res)) { return(2e30f); } else if (float.IsNegativeInfinity(res)) { return(-2e30f); } else { return(res); } }