public virtual double GetT(double length, int iterations = 32, double tolerance = 1e-06) { int numSegments = this.NumSegments; this.EnsureLengthsInitialized(); if (length <= 0) { return(this.TMin); } if (length >= this.accumLengths[numSegments - 1]) { return(this.TMax); } //Array.BinarySearch(this.accumLengths, longitud); int key = 0; for (; key < numSegments; key++) { if (length < this.accumLengths[key]) { break; } } Debug.Assert(key < numSegments); if (key >= numSegments) { return(this.TMax); } double len0; if (key == 0) { len0 = length; } else { len0 = length - this.accumLengths[key - 1]; } double len1 = this.lengths[key]; return(this.GetTMin(key) + CurveUtils.FindTime(dt => this.GetLength(key, 0, dt), dt => this.GetSpeed(key, dt), 0, this.times[key + 1] - this.times[key], len0, len1, iterations, tolerance)); }