public static Vector3 GetBezierCubicPoint(cfloat t, params Vector3[] controlPoints) { int len = controlPoints.Length; if (len != 4) { throw new ArgumentException("Should have length of 4 but has " + len, "controlPoints"); } return(GetBezierCubicPoint(t, controlPoints[0], controlPoints[1], controlPoints[2], controlPoints[3])); }
public static Vector3 GetBezierCubicPoint(cfloat t, Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3) { return(((1 - t) ^ 3) * p0 + 3 * (t ^ 1) * ((1 - t) ^ 2) * p1 + 3 * (t ^ 2) * ((1 - t) ^ 1) * p2 + (t ^ 3) * p3); }