@baku89/pave / Arc
Arc
A collection of functions to handle arcs represented with SegmentA.
Utilities
toCenterParameterization()
toCenterParameterization(
arg):object
Defined in: Arc.ts:65
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 | BareSegmentA |
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:146
Parameters
| Parameter | Type |
|---|---|
arc | BareSegmentA |
angle | number |
Returns
VertexC[]
bounds()
bounds(
arg):Rect
Defined in: Arc.ts:229
Calculates the bound of given arc.
Parameters
| Parameter | Type | Description |
|---|---|---|
arg | BareSegmentA | The arc segment to calculate |
Returns
Rect
The bound of the arc
Example
derivative()
derivative(
arc,loc):vec2
Defined in: Arc.ts:389
Parameters
| Parameter | Type |
|---|---|
arc | BareSegmentA |
loc | SegmentLocation |
Returns
vec2
divideAtTimes()
divideAtTimes(
arc,times):VertexA[]
Defined in: Arc.ts:442
Parameters
| Parameter | Type |
|---|---|
arc | BareSegmentA |
times | Iterable<number> |
Returns
VertexA[]
ellipticArcLength()
ellipticArcLength(
radii,angles):number
Defined in: Arc.ts:491
Parameters
| Parameter | Type |
|---|---|
radii | vec2 |
angles | AngleRange |
Returns
number
isStraight()
isStraight(
arc):boolean
Defined in: Arc.ts:481
Parameters
| Parameter | Type |
|---|---|
arc | BareSegmentA |
Returns
boolean
isZero()
isZero(
arg):boolean
Defined in: Arc.ts:476
Returns true if the length of arc segment is zero.
Parameters
| Parameter | Type |
|---|---|
arg | BareSegmentA |
Returns
boolean
length()
length(
arg):number
Defined in: Arc.ts:360
Parameters
| Parameter | Type |
|---|---|
arg | BareSegmentA |
Returns
number
normal()
normal(
arc,loc):vec2
Defined in: Arc.ts:407
Parameters
| Parameter | Type |
|---|---|
arc | BareSegmentA |
loc | SegmentLocation |
Returns
vec2
of()
of(
start,radii,xAxisRotation,largeArcFlag,sweepFlag,point):SegmentA
Defined in: Arc.ts:44
Parameters
| Parameter | Type |
|---|---|
start | vec2 |
radii | vec2 |
xAxisRotation | number |
largeArcFlag | boolean |
sweepFlag | boolean |
point | vec2 |
Returns
offset()
offset(
arc,distance,unarcAngle):Path
Defined in: Arc.ts:516
Parameters
| Parameter | Type | Default value |
|---|---|---|
arc | BareSegmentA | undefined |
distance | number | undefined |
unarcAngle | number | 90 |
Returns
point()
point(
arc,loc):vec2
Defined in: Arc.ts:380
Parameters
| Parameter | Type |
|---|---|
arc | BareSegmentA |
loc | SegmentLocation |
Returns
vec2
tangent()
tangent(
arc,loc):vec2
Defined in: Arc.ts:403
Parameters
| Parameter | Type |
|---|---|
arc | BareSegmentA |
loc | SegmentLocation |
Returns
vec2
toTime()
toTime(
arc,loc):number
Defined in: Arc.ts:365
Parameters
| Parameter | Type |
|---|---|
arc | BareSegmentA |
loc | SegmentLocation |
Returns
number
transform()
transform(
arc,matrix):SegmentA
Defined in: Arc.ts:274
Transforms the given arc segment with the given matrix.
Parameters
| Parameter | Type |
|---|---|
arc | BareSegmentA |
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:411
Parameters
| Parameter | Type |
|---|---|
arc | BareSegmentA |
start | SegmentLocation |
end | SegmentLocation |