# Arc

Class representing a circular arc

## Constructor

#### new Arc(pc, r, startAngle, endAngle, counterClockwise)

Source:
  - classes/arc.js, line 14

##### Parameters:

Name | Type | Description
--- | --- | ---
`pc` | `Point` | arc center
`r` | `number` | arc radius
`startAngle` | `number` | start angle in radians from 0 to 2*PI
`endAngle` | `number` | end angle in radians from 0 to 2*PI
`counterClockwise` | `boolean` | arc direction, true - clockwise, false - counter clockwise

### Classes

Arc

### Members

#### box

Get bounding box of the arc

Source:
  - classes/arc.js, line 152

#### center

Get center of arc

Source:
  - classes/arc.js, line 132

#### counterClockwise :boolean

Arc orientation

Source:
  - classes/arc.js, line 48

##### Type:

- `boolean`

#### end

Get end point of arc

Source:
  - classes/arc.js, line 123

#### endAngle :number

Arc end angle in radians

Source:
  - classes/arc.js, line 43

##### Type:

- `number`

#### length

Get arc length

Source:
  - classes/arc.js, line 144

#### pc :Point

Arc center

Source:
  - classes/arc.js, line 28

##### Type:

- `Point`

#### r :number

Arc radius

Source:
  - classes/arc.js, line 33

##### Type:

- `number`

#### start

Get start point of arc

Source:
  - classes/arc.js, line 114

#### startAngle :number

Arc start angle in radians

Source:
  - classes/arc.js, line 38

##### Type:

- `number`

#### sweep

Get sweep angle in radians. Sweep angle is non-negative number from 0 to 2*PI

Source:
  - classes/arc.js, line 86

### Methods

#### breakToFunctional() → {Array.<Arcs>}

Breaks arc in extreme point 0, pi/2, pi, 3*pi/2 and returns array of sub-arcs

Source:
  - classes/arc.js, line 313

##### Returns:

Type:
  `Array.<Arcs>`

#### chordHeight() → {number}

Returns chord height ("sagitta") of the arc

Source:
  - classes/arc.js, line 230

##### Returns:

Type:
  `number`

#### clone() → {Arc}

Return new cloned instance of arc

Source:
  - classes/arc.js, line 78

##### Returns:

Type:
  `Arc`

#### contains(pt) → {boolean}

Returns true if arc contains point, false otherwise

Source:
  - classes/arc.js, line 164

##### Parameters:

Name | Type | Description
--- | --- | ---
`pt` | `Point` | point to test

##### Returns:

Type:
  `boolean`

#### distanceTo(shape) → {number|Segment}

Calculate distance and shortest segment from arc to shape and return array [distance, shortest segment]

Source:
  - classes/arc.js, line 270

##### Parameters:

Name | Type | Description
--- | --- | ---
`shape` | `Shape` | Shape of the one of supported types Point, Line, Circle, Segment, Arc, Polygon or Planar Set

##### Returns:

- Type:
    `number`
  distance from arc to shape
- Type:
    `Segment`
  shortest segment between arc and shape (started at arc, ended at shape)

#### intersect(shape) → {Array.<Points>}

Returns array of intersection points between arc and other shape

Source:
  - classes/arc.js, line 239

##### Parameters:

Name | Type | Description
--- | --- | ---
`shape` | `Shape` | Shape of the one of supported types

##### Returns:

Type:
  `Array.<Points>`

#### middle() → {Point}

Return middle point of the arc

Source:
  - classes/arc.js, line 205

##### Returns:

Type:
  `Point`

#### pointAtLength(length) → {Point}

Get point at given length

Source:
  - classes/arc.js, line 216

##### Parameters:

Name | Type | Description
--- | --- | ---
`length` | `number` | The length along the arc

##### Returns:

Type:
  `Point`

#### reverse() → {Arc}

Returns new arc with swapped start and end angles and reversed direction

Source:
  - classes/arc.js, line 393

##### Returns:

Type:
  `Arc`

#### rotate(angle, center) → {Arc}

Return new segment rotated by given angle around given point If point omitted, rotate around origin (0,0) Positive value of angle defines rotation counter clockwise, negative - clockwise

Source:
  - classes/arc.js, line 416

##### Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`angle` | `number` | 0 | rotation angle in radians
`center` | `Point` |  | center point, default is (0,0)

##### Returns:

Type:
  `Arc`

#### scale(scaleX, scaleY) → {Arc}

Return new arc scaled by scaleX, scaleY.

Source:
  - classes/arc.js, line 428

##### Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`scaleX` | `number` | 1 | scale value by X
`scaleY` | `number` | 1 | scale value by Y

##### Returns:

Type:
  `Arc`

#### sortPoints(array) → {Array.<Point>}

Sort given array of points from arc start to end, assuming all points lay on the arc

Source:
  - classes/arc.js, line 493

##### Parameters:

Name | Type | Description
--- | --- | ---
`array` | `Array.<Point>` | of points

##### Returns:

Type:
  `Array.<Point>`

new array sorted

#### split(pt) → {Array.<Arc>}

When given point belongs to arc, return array of two arcs split by this point. If points is incident to start or end point of the arc, return clone of the arc. If point does not belong to the arcs, return empty array.

Source:
  - classes/arc.js, line 186

##### Parameters:

Name | Type | Description
--- | --- | ---
`pt` | `Point` | Query point

##### Returns:

Type:
  `Array.<Arc>`

#### svg(attrs) → {string}

Return string to draw arc in svg

Source:
  - classes/arc.js, line 522

##### Parameters:

Name | Type | Description
--- | --- | ---
`attrs` | `Object` | an object with attributes of svg path element

##### Returns:

Type:
  `string`

#### tangentInEnd() → {Vector}

Return tangent unit vector in the end point in the direction from end to start

Source:
  - classes/arc.js, line 382

##### Returns:

Type:
  `Vector`

#### tangentInStart() → {Vector}

Return tangent unit vector in the start point in the direction from start to end

Source:
  - classes/arc.js, line 371

##### Returns:

Type:
  `Vector`

#### toJSON() → {Object}

This method returns an object that defines how data will be serialized when called JSON.stringify() method

Source:
  - classes/arc.js, line 513

##### Returns:

Type:
  `Object`

#### transform(matrix) → {Arc}

Return new arc transformed using affine transformation matrix
Note 1. Non-equal scaling by x and y (abs(matrix[0]) != abs(matrix[3])) produce illegal result because it should create elliptic arc but this package does not support ellipses Note 2. Mirror transformation (matrix[0] * matrix[3] < 0) change direction of the arc to the opposite TODO: support non-equal scaling arc to ellipse or throw exception ?

Source:
  - classes/arc.js, line 443

##### Parameters:

Name | Type | Description
--- | --- | ---
`matrix` | `Matrix` | affine transformation matrix

##### Returns:

Type:
  `Arc`

#### translate(vec) → {Segment}

Returns new arc translated by vector vec

Source:
  - classes/arc.js, line 402

##### Parameters:

Name | Type | Description
--- | --- | ---
`vec` | `Vector` |

##### Returns:

Type:
  `Segment`