namespace IStation.Curve { /// /// 装置曲线辅助类 /// public class DeviceCurveHelper { /// /// /// /// /// /// /// 当designPoint超过曲线时, 是否延长装置线到designPoint位置 /// /// /// public static DeviceCurve CalcuDeviceCurve(CurveExpress CurveExpressQH, CurvePoint designPoint, double deviceCurveZeroH, bool isExendCurve, int fitPointNum, out CurvePoint sectPoint) { sectPoint = GetSectPoint(CurveExpressQH, designPoint, deviceCurveZeroH); if (sectPoint == null) { return null; } if (isExendCurve) { IStation.Curve.CurvePoint endPt; if (sectPoint.X > designPoint.X) endPt = sectPoint; else endPt = designPoint; // return new IStation.Curve.DeviceCurve(deviceCurveZeroH, endPt, fitPointNum, CurveExpressQH.FitType); } else { return new IStation.Curve.DeviceCurve(deviceCurveZeroH, sectPoint, fitPointNum, CurveExpressQH.FitType); } } /// /// /// public static CurvePoint GetSectPoint(CurveExpress CurveExpressQH, CurvePoint designPoint, double equipCurveZeroH) {//有一种情况: 用包络法有交点(在最末尾),但用装置曲线绘制时,与装置曲线没有交点,因为交点已超过曲线最大值 double ratioExtend = 1.15;//CurveExpressQH适当延长一点 var sectPoint = ParabolaCurveHelper.GetSectPoint(CurveExpressQH, designPoint, equipCurveZeroH, ratioExtend); if (sectPoint == null || sectPoint.IsZeroPoint()) { return null; } if (sectPoint.X > CurveExpressQH.Max * ratioExtend) { return null; } return sectPoint; } /// /// /// public static CurvePoint GetSectPoint(CurveExpress CurveExpressQH, CurvePoint DesignPoint, double equipCurveZeroH, double ratioExtend) {//有一种情况: 用包络法有交点(在最末尾),但用装置曲线绘制时,与装置曲线没有交点,因为交点已超过曲线最大值 var sectPoint = ParabolaCurveHelper.GetSectPoint(CurveExpressQH, DesignPoint, equipCurveZeroH, ratioExtend); if (sectPoint == null || sectPoint.IsZeroPoint()) { return null; } if (sectPoint.X > CurveExpressQH.Max * ratioExtend) { return null; } return sectPoint; } } }