namespace IStation.Curve
{
///
/// 曲线表达式
///
public class CurveExpress : JsonModel, ICloneable
{
///
///
///
public CurveExpress() { }
///
///
///
public CurveExpress(CurveExpress rhs)
{
this.FitType = rhs.FitType;
this.Min = rhs.Min;
this.Max = rhs.Max;
this.Index0 = rhs.Index0;
this.Index1 = rhs.Index1;
this.Index2 = rhs.Index2;
this.Index3 = rhs.Index3;
this.Index4 = rhs.Index4;
this.DefinePoints = rhs.DefinePoints?.Select(x => new CurvePoint(x)).ToList();
}
///
/// 拟合类型
///
public eFitType FitType { get; set; }
///
/// 最大值
///
public double Max { get; set; }
///
/// 最小值
///
public double Min { get; set; }
///
/// 0次系数
///
public double Index0 { get; set; }
///
/// 1次系数
///
public double Index1 { get; set; }
///
/// 2次系数
///
public double Index2 { get; set; }
///
/// 3次系数
///
public double Index3 { get; set; }
///
/// 4次系数
///
public double Index4 { get; set; }
///
/// 定义点
///
public List DefinePoints { get; set; }
///
/// 获取拟合点
///
public double GetFitPointY(double x)
{
return FitHelper.GetFitPointY(this, x);
}
///
/// 获取拟合点
///
public List GetFitPoints(int pointNumber = 20)
{
return FitHelper.GetFitPoints(this, pointNumber);
}
///
/// 获取X区间内拟合点
///
public List GetFitPointsByXRange(double minX, double maxX, int pointNumber = 20)
{
return FitHelper.GetFitPointsByXRange(this, minX, maxX, pointNumber);
}
///
///
///
public CurveExpress Clone()
{
return new CurveExpress(this);
}
///
///
///
object ICloneable.Clone()
{
return Clone();
}
}
}