Cubic Bezier reverse GetPoint equation: float for Vector <=> Vector for float

后端 未结 2 1159
说谎
说谎 2021-01-23 17:23

Is it possible to get float t back given the resulting value and the four points? If so, how?

public static Vector3 GetPoint (Vector3 p0, Vector3 p1, Vector3 p2,         


        
2条回答
  •  青春惊慌失措
    2021-01-23 18:21

    Solving the following cubic polynomial should reveal your original t:

    (p3 - (3 * p2) + (3 * p1) - p0) * t^3
    + ((3 * p2) - (6 * p1) + (3 * p0)) * t^2
    + ((3 * p1) - (3 * p0)) * t
    + p0
    = 0
    

    I put it in standard form so you could easily get the roots from the coefficients.

提交回复
热议问题