Exemplo n.º 1
0
        internal override void UpdatePlotData(Telerik.Windows.Data.RadObservableCollection <PlotInfo> dataCollection,
                                              Plot2DRange plotRange, uint samplesCount)
        {
            if (!this.IsValid)
            {
                return;
            }

            dataCollection.SuspendNotifications();

            dataCollection.Clear();

            double step = (plotRange.YMax - plotRange.YMin) / samplesCount;

            for (double y = plotRange.YMin; y <= plotRange.YMax; y += step)
            {
                double x = this.F(y);
                if (Double.IsInfinity(x) || Double.IsNaN(x))
                {
                    continue;
                }

                dataCollection.Add(new PlotInfo(x, y));
            }

            dataCollection.ResumeNotifications();
        }
Exemplo n.º 2
0
        private FunctionViewModel(FunctionBase function, Plot2DRange plotRange, uint samplesCount)
        {
            this.PlotData = new Telerik.Windows.Data.RadObservableCollection<PlotInfo>();
            this.isBeingEdited = false;
            this.samplesCount = samplesCount;

            this.Function = function;
            this.Function.PropertyChanged += (s,e) => this.UpdatePlotData();

            this.PlotRange = plotRange;
            this.PlotRange.PropertyChanged += (s, e) => this.UpdatePlotData();
        }
Exemplo n.º 3
0
 public static FunctionViewModel CreateInverseRealFunctionVM(Plot2DRange plotRange)
 {
     return new FunctionViewModel(
         new InverselRealFunction(),
         plotRange,
         1000);
 }
Exemplo n.º 4
0
 private FunctionViewModel(Plot2DRange plotRange)
     : this(new RealFunction(), plotRange, 1000)
 {
 }
Exemplo n.º 5
0
 public static FunctionViewModel CreateRealFunctionVM(Plot2DRange plotRange, uint samplesCount)
 {
     return new FunctionViewModel(new RealFunction(), plotRange, samplesCount);
 }
Exemplo n.º 6
0
 public static FunctionViewModel CreateRealFunctionVM(string functionString, Plot2DRange plotRange)
 {
     var f = new FunctionViewModel(plotRange);
     f.Function.FunctionString = functionString;
     return f;
 }
Exemplo n.º 7
0
 public static FunctionViewModel CreateRealFunctionVM(Plot2DRange plotRange)
 {
     return new FunctionViewModel(plotRange);
 }
Exemplo n.º 8
0
 internal abstract void UpdatePlotData(Telerik.Windows.Data.RadObservableCollection<PlotInfo> dataCollection,
     Plot2DRange plotRange, uint samplesCount);
Exemplo n.º 9
0
        internal override void UpdatePlotData(Telerik.Windows.Data.RadObservableCollection<PlotInfo> dataCollection,
            Plot2DRange plotRange, uint samplesCount)
        {
            if (!this.IsValid)
                return;

            dataCollection.SuspendNotifications();

            dataCollection.Clear();

            double step = (plotRange.XMax - plotRange.XMin) / samplesCount;

            for (double x = plotRange.XMin; x <= plotRange.XMax; x += step)
            {
                double y = this.F(x);
                if (Double.IsInfinity(y) || Double.IsNaN(y))
                    dataCollection.Add(new PlotInfo(x, double.NaN));

                dataCollection.Add(new PlotInfo(x, y));
            }

            dataCollection.ResumeNotifications();
        }
Exemplo n.º 10
0
 internal abstract void UpdatePlotData(Telerik.Windows.Data.RadObservableCollection <PlotInfo> dataCollection,
                                       Plot2DRange plotRange, uint samplesCount);