private static IEnumerable <double> GetTimes(ICurve1 curve, double tinc) { if (curve is MultiCurve1) { TimeList times = new TimeList(); MultiCurve1 multi = (MultiCurve1)curve; for (int i = 0; i < multi.NumSegments; i++) { double tmin = multi.GetTMin(i); double tmax = multi.GetTMax(i); double t = tmin; while (t < tmax) { times.Add(t); t += tinc; } times.Add(tmax); } return(times.GetTimes()); } else { TimeList times = new TimeList(); double tmin = curve.TMin; double tmax = curve.TMax; double t = tmin; while (t < tmax) { times.Add(t); t += tinc; } times.Add(tmax); return(times.GetTimes()); } }
private static IEnumerable <double> GetTimes(ICurve2 curve, double tinc) { if (curve is MultiCurve2) { TimeList times = new TimeList(); MultiCurve2 multi = (MultiCurve2)curve; for (int i = 0; i < multi.NumSegments; i++) { double tmin = multi.GetTMin(i); double tmax = multi.GetTMax(i); double t = tmin; while (t < tmax) { times.Add(t); t += tinc; } times.Add(tmax); } return(times.GetTimes()); } else if (curve is DisplacedCurve2) { DisplacedCurve2 displaced = (DisplacedCurve2)curve; return(MathUtils.ConcatSorted(GetTimes(displaced.Curve, tinc), GetTimes(displaced.Displacement, tinc))); } else { TimeList times = new TimeList(); double tmin = curve.TMin; double tmax = curve.TMax; double t = tmin; while (t < tmax) { times.Add(t); t += tinc; } times.Add(tmax); return(times.GetTimes()); } }