Pomax / BezierInfo-2

The development repo for the Primer on Bézier curves, https://pomax.github.io/bezierinfo
https://pomax.github.io/bezierinfo
Other
2.35k stars 290 forks source link

another (simpler) inflection calculation #397

Open kanou-h opened 4 weeks ago

kanou-h commented 4 weeks ago

We can calculate the inflection of a cubic Bezier curve defined by (P0, P1, P2, P3) without aligning it:

Define vector variables V0 = P1 - P0, V1 = P2 - P1, V2 = P3 - P2, A0 = V1 - V0, A1 = V2 - V1 and cross product P×Q as cross(P, Q) = P.x Q.y - P.y Q.x, then the coefficients of quadratic equation a tt + b t + c = 0 can be expressed as a = cross(A1, A0), c = cross(V1, V0), b = cross(V2, V0) - 2 c.