# Ray

Class representing a ray (a half-infinite line).

## Constructor

#### new Ray(pt, norm)

Ray may be constructed by setting an origin point and a normal vector, so that any point x on a ray fit an equation:
(x - origin) * vector = 0
Ray defined by constructor is a right semi-infinite line with respect to the normal vector
If normal vector is omitted ray is considered horizontal (normal vector is (0,1)).
Don't be confused: direction of the normal vector is orthogonal to the ray

Source:
  - classes/ray.js, line 21

##### Parameters:

Name | Type | Description
--- | --- | ---
`pt` | `Point` | start point
`norm` | `Vector` | normal vector

### Classes

Ray

### Members

#### box

Returns half-infinite bounding box of the ray

Source:
  - classes/ray.js, line 71

#### end

Ray has no end point?

Source:
  - classes/ray.js, line 93

#### length

Return positive infinity number as length

Source:
  - classes/ray.js, line 99

#### slope

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

Source:
  - classes/ray.js, line 62

#### start

Return ray start point

Source:
  - classes/ray.js, line 85

### Methods

#### clone() → {Ray}

Return new cloned instance of ray

Source:
  - classes/ray.js, line 54

##### Returns:

Type:
  `Ray`

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

Returns true if point belongs to ray

Source:
  - classes/ray.js, line 106

##### Parameters:

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

##### Returns:

Type:
  `boolean`

#### intersect(shape) → {Array}

Returns array of intersection points between ray and segment or arc

Source:
  - classes/ray.js, line 140

##### Parameters:

Name | Type | Description
--- | --- | ---
`shape` | `Segment` | `Arc` | Shape to intersect with ray

##### Returns:

Type:
  `Array`

array of intersection points

#### split(pt)

Split ray with point and return array of segment and new ray

Source:
  - classes/ray.js, line 121

##### Parameters:

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

##### Returns:

[Segment,Ray]

#### svg(box, attrs)

Return string to draw svg segment representing ray inside given box

Source:
  - classes/ray.js, line 201

##### Parameters:

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