和线性差值一样
传入坐标点数组和0到1的区间值,返回坐标
public Vector3 BesselCurve(Vector3[] pos, float t)
{
Vector3[] arr = new Vector3[pos.Length - 1];
for (int i = 0; i < arr.Length; i++)
{
arr[i] = pos[i] * (1 - t) + pos[i + 1] * t;
Debug.DrawLine(pos[i], pos[i + 1], Color.red);
}
if (arr.Length == 1)
{
return arr[0];
}
else
{
return BesselCurve(arr, t);
}
}