Skip to main content

fit-quads-to-cubic

function fitQuadsToCubic(ps: number[][], tolerance: number): number[][][]

Defined in fit/fit-quads-to-cubic.ts:24

Approximate the given cubic bezier curve (up to the given tolerance) by fitting an array of ordered (by t value) piecewise bezier curves (of quadratic order or less).

  • the start and end point of each approximating curve lies on the cubic curve and the the tangents of each approximating curve coincide with that of the cubic at each such point
Note!
Green circles are draggable!
0

Parameters:

NameTypeDescription
psnumber[][]a cubic bezier curve given as an ordered array of its control point coordinates, e.g. [[0,0], [1,1], [2,1], [2,0]]
tolerancenumbertolerance given as the maximum total absolute area difference between the two curves