public CurveF Clone() { CurveF c = (CurveF)this.MemberwiseClone(); c.name = (string)name.Clone(); c.data = (PointF[])data.Clone(); return(c); }
private void GeneratePlot() { double orginalXVarValue = xVar.Variable.Value; double xValue; double yValue; double pValue = 0; int numOfCurves; int numOfPoints = 50; PointF[] dataPoints = new PointF[101]; CurveF[] curves; if (includePVar) { double orginalPVarValue = pVar.Variable.Value; double[] paramValues = pVar.ParameterValues; numOfCurves = paramValues.Length; curves = new CurveF[numOfCurves]; for (int i = 0; i < numOfCurves; i++) { pValue = paramValues[i]; pVar.Variable.Owner.Specify(pVar.Variable, pValue); for (int j = 0; j < numOfPoints; j++) { xValue = xVar.Min + j * (xVar.Max - xVar.Min) / (numOfPoints - 1); xVar.Variable.Owner.Specify(xVar.Variable, xValue); yValue = yVar.Variable.Value; dataPoints[j] = new PointF((float)xValue, (float)yValue); } curves[i] = new CurveF(pVar.Name, (float)pValue, dataPoints); } pVar.Variable.Owner.Specify(pVar.Variable, orginalPVarValue); } else { curves = new CurveF[1]; for (int j = 0; j < numOfPoints; j++) { xValue = xVar.Min + j * (xVar.Max - xVar.Min) / (numOfPoints - 1); xVar.Variable.Owner.Specify(xVar.Variable, xValue); yValue = yVar.Variable.Value; dataPoints[j] = new PointF((float)xValue, (float)yValue); } curves[0] = new CurveF(yVar.Name, (float)pValue, dataPoints); } curveFamily = new CurveFamilyF(yVar.Name, yVar.Variable.Type, curves); xVar.Variable.Owner.Specify(xVar.Variable, orginalXVarValue); }
public override bool Equals(object obj) { bool isEqual = false; CurveF cf = obj as CurveF; if (this.name.Equals(cf.Name) && this.pq == cf.PhysicalQuantity && this.val == cf.Value && data.Length == cf.Data.Length) { for (int i = 0; i < data.Length; i++) { if (data[i].X == cf.Data[i].X && data[i].Y == cf.Data[i].Y) { isEqual = true; } else { isEqual = false; break; } } } return(isEqual); }