1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| public class BezierTool { public static Vector3 BezierMath2(Vector3 p0, Vector3 p1, Vector3 p2, float t) { return (1 - t) * (1 - t) * p0 + 2 * (1 - t) * t * p1 + t * t * p2; }
public static Vector3 Bezier_3(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t) { return (1 - t) * ((1 - t) * ((1 - t) * p0 + t * p1) + t * ((1 - t) * p1 + t * p2)) + t * ((1 - t) * ((1 - t) * p1 + t * p2) + t * ((1 - t) * p2 + t * p3)); } }
|