A: Point

The origin point, {x, y}

B: Point

The destination point, {x, y}

y0: number

The origin y-coordinate

x0: number

The origin x-coordinate

dx: number

The horizontal distance of the ray, x1 - x0

dy: number

The vertical distance of the ray, y1 - y0

slope: number

The slope of the ray, dy over dx

`Private`

_angle_angle: number = undefined

The cached angle, computed lazily in Ray#angle

`Private`

_distance_distance: number = undefined

The cached distance, computed lazily in Ray#distance

- get angle(): number
The normalized angle of the ray in radians on the range (-PI, PI). The angle is computed lazily (only if required) and cached.

#### Returns number

- set angle(value): void
#### Parameters

- value: number

#### Returns void

- get distance(): number
The distance (length) of the Ray in pixels. The distance is computed lazily (only if required) and cached.

#### Returns number

- set distance(value): void
#### Parameters

- value: number

#### Returns void

- shift
Angle (offset, distance?): Ray Create a new ray which uses the same origin point, but a slightly offset angle and distance

#### Parameters

- offset: number
An offset in radians which modifies the angle of the original Ray

`Optional`

distance: numberA distance the new ray should project, otherwise uses the same distance.

#### Returns Ray

A new Ray with an offset angle

- offset: number

- intersect
Segment (coords): LineIntersection Find the point I[x,y] and distance t* on ray R(t) which intersects another ray

#### Parameters

- coords: any

#### Returns LineIntersection

#### See

foundry.utils.lineLineIntersection

`Static`

from- from
Angle (x, y, radians, distance): Ray A factory method to construct a Ray from an origin point, an angle, and a distance

#### Parameters

- x: number
The origin x-coordinate

- y: number
The origin y-coordinate

- radians: number
The ray angle in radians

- distance: number
The distance of the ray in pixels

#### Returns Ray

The constructed Ray instance

- x: number

`Static`

from`Static`

towards`Static`

towards
A ray for the purposes of computing sight and collision Given points A[x,y] and B[x,y]

Slope-Intercept form: y = a + bx y = A.y + ((B.y - A.Y) / (B.x - A.x))x

Parametric form: R(t) = (1-t)A + tB

## Param: A

The origin of the Ray

## Param: B

The destination of the Ray