Skip to main content

get-bounds

function getBounds(ps: number[][]): object

Defined in global-properties/bounds/get-bounds.ts:15

Returns an axis-aligned bounding box together with the t values where the bounds on the bezier are reached.

Note!
Green circles are draggable!
Example
getBounds([[1, 1], [5.78125, 7.21875], [11.8125, 1.3125], [6.21875, 6.21875]])//=> { ts: [[0, 0], [0.7141653173100411, 1]], box: [[1, 1], [8.466745972337957, 6.21875]] }

Parameters:

NameTypeDescription
psnumber[][]an order 1,2 or 3 bezier curve given as an array of its control points, e.g. [[0,0], [1,1], [2,1], [2,0]]

Returns: object

NameType
tsnumber[][]
boxnumber[][]