private double GetPositionX(ref Point start, double relPosition) { double resX; if (relPosition == 0) { resX = start.X; } else if (relPosition == 1) { resX = this.EndPoint.X; } else { var param = new IterParams() { Length = relPosition * GetLength(ref start), StartX = start.X }; Iterations.NewtonMethod( delegate(double x, IterParams p) { var l1 = EvaluateLengthIntegral(p.StartX); var l2 = EvaluateLengthIntegral(x); return(Math.Abs(l1 - l2) - p.Length); }, param, ////EndPoint.X, ... this is for secant method start.X + (relPosition * (EndPoint.X - start.X)), 1e-6, out resX); } return(resX); }