@baku89/pave / Arc
Arc
A collection of functions to handle arcs represented with SegmentA.
Utilities
toCenterParameterization()
toCenterParameterization(
arg
):object
Defined in: Arc.ts:28
Converts the Arc command to a center parameterization that can be used in Context2D.ellipse(). https://observablehq.com/@awhitty/svg-2-elliptical-arc-to-canvas-path2d
Parameters
Parameter | Type |
---|---|
arg | SimpleSegmentA |
Returns
object
Name | Type | Default value |
---|---|---|
angles | AngleRange | - |
center | vec2 | - |
radii | vec2 | - |
sweep | boolean | true |
xAxisRotation | number | - |
Other
approximateByCubicBeziers()
approximateByCubicBeziers(
arc
,angle
):VertexC
[]
Defined in: Arc.ts:113
Parameters
Parameter | Type |
---|---|
arc | SimpleSegmentA |
angle | number |
Returns
VertexC
[]
bounds()
bounds(
arg
):Rect
Defined in: Arc.ts:196
Calculates the bound of given arc.
Parameters
Parameter | Type |
---|---|
arg | SimpleSegmentA |
Returns
The bound of the arc
Example
derivative()
derivative(
arc
,loc
):vec2
Defined in: Arc.ts:366
Parameters
Parameter | Type |
---|---|
arc | SimpleSegmentA |
loc | SegmentLocation |
Returns
vec2
divideAtTimes()
divideAtTimes(
arc
,times
):VertexA
[]
Defined in: Arc.ts:415
Parameters
Parameter | Type |
---|---|
arc | SimpleSegmentA |
times | Iterable <number > |
Returns
VertexA
[]
ellipticArcLength()
ellipticArcLength(
radii
,angles
):number
Defined in: Arc.ts:464
Parameters
Parameter | Type |
---|---|
radii | vec2 |
angles | AngleRange |
Returns
number
isStraight()
isStraight(
arc
):boolean
Defined in: Arc.ts:454
Parameters
Parameter | Type |
---|---|
arc | SimpleSegmentA |
Returns
boolean
isZero()
isZero(
arg
):boolean
Defined in: Arc.ts:449
Returns true if the length of arc segment is zero.
Parameters
Parameter | Type |
---|---|
arg | SimpleSegmentA |
Returns
boolean
length()
length(
arg
):number
Defined in: Arc.ts:337
Parameters
Parameter | Type |
---|---|
arg | SimpleSegmentA |
Returns
number
normal()
normal(
arc
,loc
):vec2
Defined in: Arc.ts:381
Parameters
Parameter | Type |
---|---|
arc | SimpleSegmentA |
loc | SegmentLocation |
Returns
vec2
offset()
offset(
arc
,distance
,unarcAngle
):Path
Defined in: Arc.ts:498
Parameters
Parameter | Type | Default value |
---|---|---|
arc | SimpleSegmentA | undefined |
distance | number | undefined |
unarcAngle | number | 90 |
Returns
point()
point(
arc
,loc
):vec2
Defined in: Arc.ts:357
Parameters
Parameter | Type |
---|---|
arc | SimpleSegmentA |
loc | SegmentLocation |
Returns
vec2
tangent()
tangent(
arc
,loc
):vec2
Defined in: Arc.ts:377
Parameters
Parameter | Type |
---|---|
arc | SimpleSegmentA |
loc | SegmentLocation |
Returns
vec2
toTime()
toTime(
arc
,loc
):number
Defined in: Arc.ts:342
Parameters
Parameter | Type |
---|---|
arc | SimpleSegmentA |
loc | SegmentLocation |
Returns
number
transform()
transform(
arc
,matrix
):SegmentA
Defined in: Arc.ts:252
Transforms the given arc segment with the given matrix.
Parameters
Parameter | Type |
---|---|
arc | SimpleSegmentA |
matrix | mat2d |
Returns
See
https://gist.github.com/timo22345/9413158#file-flatten-js-L443-L547
trim()
trim(
arc
,start
,end
):SegmentA
Defined in: Arc.ts:385
Parameters
Parameter | Type |
---|---|
arc | SimpleSegmentA |
start | SegmentLocation |
end | SegmentLocation |