public PointF GetSlopePupilFullness(EyeEnum eye, int numSamples) { TrackData[] tds = db.ToArray(); var points = new PointF[numSamples]; var direction = new PointF(); var pointOnLine = new PointF(); for (int i = tds.Length - 1; i >= tds.Length - numSamples; i--) { if (eye == EyeEnum.Left && tds[i].PupilDataLeft.Blob != null) { points[tds.Length - i - 1] = new PointF(i, (float)tds[i].PupilDataLeft.Blob.Fullness); } } PointCollection.Line2DFitting(points, DIST_TYPE.CV_DIST_L2, out direction, out pointOnLine); return(direction); }