@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:126
Parameters
| Parameter | Type |
|---|---|
arc | SimpleSegmentA |
angle | number |
Returns
VertexC[]
bounds()
bounds(
arg):Rect
Defined in: Arc.ts:209
Calculates the bound of given arc.
Parameters
| Parameter | Type |
|---|---|
arg | SimpleSegmentA |
Returns
Rect
The bound of the arc
Example
derivative()
derivative(
arc,loc):vec2
Defined in: Arc.ts:385
Parameters
| Parameter | Type |
|---|---|
arc | SimpleSegmentA |
loc | SegmentLocation |
Returns
vec2
divideAtTimes()
divideAtTimes(
arc,times):VertexA[]
Defined in: Arc.ts:434
Parameters
| Parameter | Type |
|---|---|
arc | SimpleSegmentA |
times | Iterable<number> |
Returns
VertexA[]
ellipticArcLength()
ellipticArcLength(
radii,angles):number
Defined in: Arc.ts:483
Parameters
| Parameter | Type |
|---|---|
radii | vec2 |
angles | AngleRange |
Returns
number
isStraight()
isStraight(
arc):boolean
Defined in: Arc.ts:473
Parameters
| Parameter | Type |
|---|---|
arc | SimpleSegmentA |
Returns
boolean
isZero()
isZero(
arg):boolean
Defined in: Arc.ts:468
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:356
Parameters
| Parameter | Type |
|---|---|
arg | SimpleSegmentA |
Returns
number
normal()
normal(
arc,loc):vec2
Defined in: Arc.ts:400
Parameters
| Parameter | Type |
|---|---|
arc | SimpleSegmentA |
loc | SegmentLocation |
Returns
vec2
offset()
offset(
arc,distance,unarcAngle):Path
Defined in: Arc.ts:517
Parameters
| Parameter | Type | Default value |
|---|---|---|
arc | SimpleSegmentA | undefined |
distance | number | undefined |
unarcAngle | number | 90 |
Returns
point()
point(
arc,loc):vec2
Defined in: Arc.ts:376
Parameters
| Parameter | Type |
|---|---|
arc | SimpleSegmentA |
loc | SegmentLocation |
Returns
vec2
tangent()
tangent(
arc,loc):vec2
Defined in: Arc.ts:396
Parameters
| Parameter | Type |
|---|---|
arc | SimpleSegmentA |
loc | SegmentLocation |
Returns
vec2
toTime()
toTime(
arc,loc):number
Defined in: Arc.ts:361
Parameters
| Parameter | Type |
|---|---|
arc | SimpleSegmentA |
loc | SegmentLocation |
Returns
number
transform()
transform(
arc,matrix):SegmentA
Defined in: Arc.ts:265
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:404
Parameters
| Parameter | Type |
|---|---|
arc | SimpleSegmentA |
start | SegmentLocation |
end | SegmentLocation |