public double getValue(double x)
	{
		if (len.length == 0)
		{
			return Double.NaN;
		}

		if (len.length == 1)
		{
			if (len[0] == x)
			{
				return pos1D[0];
			}
			else
			{
				return Double.NaN;
			}
		}

		int index = Arrays.binarySearch(len, x);
		if (index > 0)
		{
			return pos1D[index];
		}

		index = - (index + 1) - 1;
		//TODO linear interpolation or extrapolation
		if (index < 0) {
			return pos1D[0];
		}

		return a[index]
			+ b[index] * (x - len[index])
			+ c[index] * Math.pow(x - len[index], 2)
			+ d[index] * Math.pow(x - len[index], 3);
	}