@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
Name | Type |
---|---|
arg | SimpleSegmentC |
Returns
[vec2
, vec2
]
Defined in
derivative
▸ derivative(bezier
, loc
): vec2
Calculates the curve tangent at the specified t
value. Note that this yields a not-normalized vector.
Parameters
Name | Type |
---|---|
bezier | SimpleSegmentC |
loc | SegmentLocation |
Returns
vec2
Defined in
divideAtTimes
▸ divideAtTimes(segment
, times
): VertexC
[]
Parameters
Name | Type |
---|---|
segment | SimpleSegmentC |
times | Iterable <number > |
Returns
VertexC
[]
Defined in
fromQuadraticBezier
▸ fromQuadraticBezier(start
, control
, point
): SegmentC
Parameters
Name | Type |
---|---|
start | vec2 |
control | vec2 |
point | vec2 |
Returns
Defined in
isStraight
▸ isStraight(bezier
): boolean
Parameters
Name | Type |
---|---|
bezier | SimpleSegmentC |
Returns
boolean
Defined in
isZero
▸ isZero(bezier
): boolean
Parameters
Name | Type |
---|---|
bezier | SimpleSegmentC |
Returns
boolean
Defined in
length
▸ length(arg
): number
Calculates the length of the Bezier curve. Length is calculated using numerical approximation, specifically the Legendre-Gauss quadrature algorithm.
Parameters
Name | Type |
---|---|
arg | SimpleSegmentC |
Returns
number
Defined in
normal
▸ normal(bezier
, loc
): vec2
Calculates the curve normal at the specified t
value. Note that this yields a normalized vector.
Parameters
Name | Type |
---|---|
bezier | SimpleSegmentC |
loc | SegmentLocation |
Returns
vec2
Defined in
of
▸ of(start
, control1
, control2
, point
): Object
Parameters
Name | Type |
---|---|
start | vec2 |
control1 | vec2 |
control2 | vec2 |
point | vec2 |
Returns
Object
Name | Type |
---|---|
args | vec2 [] |
command | string |
point | vec2 |
start | vec2 |
Defined in
offset
▸ offset(bezier
, distance
): Path
Parameters
Name | Type |
---|---|
bezier | SimpleSegmentC |
distance | number |
Returns
Defined in
point
▸ point(bezier
, loc
): vec2
Calculates the point on the curve at the specified t
value.
Parameters
Name | Type |
---|---|
bezier | SimpleSegmentC |
loc | SegmentLocation |
Returns
vec2
Defined in
project
▸ project(bezier
, origin
): Object
Finds the on-curve point closest to the specific off-curve point
Parameters
Name | Type |
---|---|
bezier | SimpleSegmentC |
origin | vec2 |
Returns
Object
Name | Type |
---|---|
distance? | number |
position | vec2 |
t? | number |
Defined in
tangent
▸ tangent(bezier
, loc
): vec2
Calculates the curve tangent at the specified t
value. Unlike derivative, this yields a normalized vector.
Parameters
Name | Type |
---|---|
bezier | SimpleSegmentC |
loc | SegmentLocation |
Returns
vec2
Defined in
toPaperBezier
▸ toPaperBezier(arg
): Curve
Parameters
Name | Type |
---|---|
arg | SimpleSegmentC |
Returns
Curve
Defined in
toTime
▸ toTime(bezier
, loc
): number
Parameters
Name | Type |
---|---|
bezier | SimpleSegmentC |
loc | SegmentLocation |
Returns
number
Defined in
trim
▸ trim(bezier
, start
, end
): SegmentC
Parameters
Name | Type |
---|---|
bezier | SimpleSegmentC |
start | SegmentLocation |
end | SegmentLocation |