Class: DefBezier

algeobra~DefBezier(points)

Definition of a Bezier curve. A Bezier curve is specified by its control points

Constructor

new DefBezier(points)

Default value
Parameters:
Name Type Description
points Array.<{x:Number, y:Number}> An array of control points
Source:

Methods

compute(createInfo) → {Object}

Computes the Bezier curve
Parameters:
Name Type Description
createInfo CreateInfo The creation info
Source:
Returns:
A Bezier curve of type TYPE_BEZIER
Type
Object

(static) fromHermite(p0, t0, p1, t1) → {CreateInfo}

Computes a Cubic Hermite Bezier curve
Parameters:
Name Type Description
p0 Number | Object Either the index or value of an array of points of type TYPE_POINT. The point array
t0 Number | Object Either the index or value of an array of points of type TYPE_VECTOR. The point array
p1 Number | Object Either the index or value of an array of points of type TYPE_POINT. The point array
t1 Number | Object Either the index or value of an array of points of type TYPE_VECTOR. The point array
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromPointArray(pointArray, attach) → {CreateInfo}

Computes a Bezier curve from an array of control points stored as a value
Parameters:
Name Type Default Description
pointArray Number | Object Either the index or value of an array of points of type TYPE_POINT. The point array
attach Boolean false Whether the points should be attached to the points already specified for this Bezier curve
Source:
Returns:
The creation info
Type
CreateInfo

(static) fromPoints(points, attach) → {CreateInfo}

Computes a Bezier curve from an array of control points
Parameters:
Name Type Default Description
points Array.<(Number|Object)> Either the indices or values of TYPE_POINT. The points from which to make the Bezier curve of
attach Boolean false Whether the points should be attached to the points already specified for this Bezier curve
Source:
Returns:
The creation info
Type
CreateInfo

(static) hermiteToCubic(p0, t0, p1, t1) → {Array.<{x:Number, y:Number}>}

Converts a hermite to a Bezier curve
Parameters:
Name Type Description
p0 Object The first point
t0 Object The first tangent
p1 Object The second point
t1 Object The second tangent
Source:
Returns:
The equivalent cubic Bezier control points
Type
Array.<{x:Number, y:Number}>