@baku89/pave - v0.4.1 / CubicBezier

Namespace: CubicBezier

A collection of functions to handle a cubic bezier represented with SimpleSegment.

Functions

bounds

bounds(arg): [vec2, vec2]

Calculates the rect of this Bezier curve.

Parameters

NameType
argSimpleSegmentC

Returns

[vec2, vec2]

Defined in

CubicBezier.ts:61open in new window


derivative

derivative(bezier, loc): vec2

Calculates the curve tangent at the specified t value. Note that this yields a not-normalized vector.

Parameters

NameType
bezierSimpleSegmentC
locSegmentLocation

Returns

vec2

Defined in

CubicBezier.ts:118open in new window


divideAtTimes

divideAtTimes(segment, times): VertexC[]

Parameters

NameType
segmentSimpleSegmentC
timesIterable<number>

Returns

VertexC[]

Defined in

CubicBezier.ts:195open in new window


fromQuadraticBezier

fromQuadraticBezier(start, control, point): SegmentC

Parameters

NameType
startvec2
controlvec2
pointvec2

Returns

SegmentC

Defined in

CubicBezier.ts:39open in new window


isStraight

isStraight(bezier): boolean

Parameters

NameType
bezierSimpleSegmentC

Returns

boolean

Defined in

CubicBezier.ts:225open in new window


isZero

isZero(bezier): boolean

Parameters

NameType
bezierSimpleSegmentC

Returns

boolean

Defined in

CubicBezier.ts:212open in new window


length

length(arg): number

Calculates the length of the Bezier curve. Length is calculated using numerical approximation, specifically the Legendre-Gauss quadrature algorithm.

Parameters

NameType
argSimpleSegmentC

Returns

number

Defined in

CubicBezier.ts:53open in new window


normal

normal(bezier, loc): vec2

Calculates the curve normal at the specified t value. Note that this yields a normalized vector.

Parameters

NameType
bezierSimpleSegmentC
locSegmentLocation

Returns

vec2

Defined in

CubicBezier.ts:139open in new window


of

of(start, control1, control2, point): Object

Parameters

NameType
startvec2
control1vec2
control2vec2
pointvec2

Returns

Object

NameType
argsvec2[]
commandstring
pointvec2
startvec2

Defined in

CubicBezier.ts:20open in new window


offset

offset(bezier, distance): Path

Parameters

NameType
bezierSimpleSegmentC
distancenumber

Returns

Path

Defined in

CubicBezier.ts:261open in new window


point

point(bezier, loc): vec2

Calculates the point on the curve at the specified t value.

Parameters

NameType
bezierSimpleSegmentC
locSegmentLocation

Returns

vec2

Defined in

CubicBezier.ts:93open in new window


project

project(bezier, origin): Object

Finds the on-curve point closest to the specific off-curve point

Parameters

NameType
bezierSimpleSegmentC
originvec2

Returns

Object

NameType
distance?number
positionvec2
t?number

Defined in

CubicBezier.ts:146open in new window


tangent

tangent(bezier, loc): vec2

Calculates the curve tangent at the specified t value. Unlike derivative, this yields a normalized vector.

Parameters

NameType
bezierSimpleSegmentC
locSegmentLocation

Returns

vec2

Defined in

CubicBezier.ts:132open in new window


toPaperBezier

toPaperBezier(arg): Curve

Parameters

NameType
argSimpleSegmentC

Returns

Curve

Defined in

CubicBezier.ts:24open in new window


toTime

toTime(bezier, loc): number

Parameters

NameType
bezierSimpleSegmentC
locSegmentLocation

Returns

number

Defined in

CubicBezier.ts:71open in new window


trim

trim(bezier, start, end): SegmentC

Parameters

NameType
bezierSimpleSegmentC
startSegmentLocation
endSegmentLocation

Returns

SegmentC

Defined in

CubicBezier.ts:155open in new window