# Line

Class representing a line

## Constructor

#### new Line(pt, norm)

Line may be constructed by point and normal vector or by two points that a line passes through

Source:
  - classes/line.js, line 11

##### Parameters:

Name | Type | Description
--- | --- | ---
`pt` | `Point` | point that a line passes through
`norm` | `Vector` | `Point` | normal vector to a line or second point a line passes through

### Members

#### norm :Vector

Normal vector to a line
Vector is normalized (length == 1)

Source:
  - classes/line.js, line 28

##### Type:

- `Vector`

#### pt :Point

Point a line passes through

Source:
  - classes/line.js, line 22

##### Type:

- `Point`

#### slope

Slope of the line - angle in radians between line and axe x from 0 to 2PI

Source:
  - classes/line.js, line 87

#### standard

Get coefficients [A,B,C] of a standard line equation in the form Ax + By = C

Source:
  - classes/line.js, line 97

### Methods

#### clone() → {Line}

Returns cloned new instance of a line

Source:
  - classes/line.js, line 79

##### Returns:

Type:
  `Line`

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

Returns true if point belongs to line

Source:
  - classes/line.js, line 128

##### Parameters:

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

##### Returns:

Type:
  `boolean`

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

Calculate distance and shortest segment from line to shape and returns array [distance, shortest_segment]

Source:
  - classes/line.js, line 175

##### Parameters:

Name | Type | Description
--- | --- | ---
`shape` | `Shape` | Shape of the one of the types Point, Circle, Segment, Arc, Polygon

##### Returns:

- Type:
    `Number`
- Type:
    `Segment`

#### incidentTo(other_line) → {boolean}

Returns true if incident to other line

Source:
  - classes/line.js, line 119

##### Parameters:

Name | Type | Description
--- | --- | ---
`other_line` | `Line` | line to check

##### Returns:

Type:
  `boolean`

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

Returns array of intersection points

Source:
  - classes/line.js, line 142

##### Parameters:

Name | Type | Description
--- | --- | ---
`shape` | `Shape` | shape to intersect with

##### Returns:

Type:
  `Array.<Point>`

#### parallelTo(other_line) → {boolean}

Return true if parallel or incident to other line

Source:
  - classes/line.js, line 110

##### Parameters:

Name | Type | Description
--- | --- | ---
`other_line` | `Line` | line to check

##### Returns:

Type:
  `boolean`

#### svg(box, attrs)

Return string to draw svg segment representing line inside given box

Source:
  - classes/line.js, line 211

##### Parameters:

Name | Type | Description
--- | --- | ---
`box` | `Box` | Box representing drawing area
`attrs` | `Object` | an object with attributes of svg circle element

#### toJSON() → {Object}

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

Source:
  - classes/line.js, line 227

##### Returns:

Type:
  `Object`