Вопрос

I have bezier curve with about 48 ctrl points and I want to transform it to many cubic bezier curves... Any algorthim , math theory or just a link may help :) ??

Это было полезно?

Решение

Math theory: you cannot do this. An nth order Bezier curve cannot be represented as any number of (n-1)th order Bezier curves, because the curvatures cannot be faithfully represented. You can approximate it, but you won't get an identical result.

Practice: you can cut up your 48th order curve into sections of simple curve, where all the control points are on the same side of the start/end baseline, and the midpoint on the curve w.r.t your control variable is roughly in the center of the convex hull for the curve. For such curves, low level curves are reasonable approximations. You can do this by finding the inflections on the curve using the first, second, etc. derivative roots for your 48th order curve (see http://pomax.github.com/bezierinfo/#derivatives and http://pomax.github.com/bezierinfo/#splitting) and then running de Casteljau's algorithm to split up the curve between each inflection point's control variable value. You can then approximate each of the resultant subcurves with cubic curves and the result will look pretty close (or look identical at the pixel level) to your original curve.

That said: why the hell do you even have a 48th order curve, that's insane =P

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top