Find all the points of a cubic bezier curve in javascript

前端 未结 3 817
-上瘾入骨i
-上瘾入骨i 2020-12-30 15:54

I have a cubic bezier with 2 control points. Starting point and control points are known. Need to get all the points of the curve, given the control, starting and ending poi

3条回答
  •  独厮守ぢ
    2020-12-30 16:11

    De Casteljau algorithm is more numerically stable. Here it has additional advantage that it calculates the tangent line (and thus, the tangent angle) as the step immediately prior to calculating the point.

    But, it works according to a parameter value, not length. It is preferable to calculate points by parameter, not value, as part of rendering the curve. Parameter's range will be [0 ... 1], 0 corresponding to the starting, and 1 the ending point of the curve.

提交回复
热议问题