B.Math.Ray()

Represents a ray.

To create the object use B.Math.makeRay().

PROPERTIES:

{B.Math.Vector3} origin

Origin of the ray.

{B.Math.Vector3} direction

Direction of the ray.

METHODS:

clone()

Clones this ray to a new ray.

RETURNS:

{B.Math.Ray}

this

copy(ray)

Copies a given ray into this ray.

PARAMETERS:

{B.Math.Ray} ray

RETURNS:

{B.Math.Ray}

this

set(origin, direction)

Sets this ray from an origin and a direction.

PARAMETERS:

{B.Math.Vector3} origin

{B.Math.Vector3} direction

RETURNS:

{B.Math.Ray}

this

fromArray(array, offset)

Sets this ray from a part of array.

PARAMETERS:

{Array.<number>} array

{number} [offset] = 0

RETURNS:

{number}

new offset

toArray(array, offset)

Sets this ray to a part of array.

PARAMETERS:

{Array.<number>} array

{number} [offset] = 0

RETURNS:

{number}

new offset

fromOriginTarget(origin, target)

Sets this ray from an origin and a target.

PARAMETERS:

{B.Math.Vector3} origin

{B.Math.Vector3} target

RETURNS:

{B.Math.Ray}

this

translate(offset)

Translates this ray by a given offset.

PARAMETERS:

{B.Math.Vector3} offset

RETURNS:

{B.Math.Ray}

this

transform(matrix)

Transforms this ray by a 4x4 matrix.

PARAMETERS:

{B.Math.Matrix4} matrix

RETURNS:

{B.Math.Ray}

this

at(t, result)

Gets a point at this ray.

PARAMETERS:

{number} t

[0, +Infinity]

{B.Math.Vector3} [result]

omit if you want to return newly created vector

RETURNS:

{B.Math.Vector3}

point

projectPoint(point, result)

Projects a point to this ray.

PARAMETERS:

{B.Math.Vector3} point

{B.Math.Vector3} [result]

omit if you want to return newly created vector

RETURNS:

{B.Math.Vector3}

projected point

trace(object, point)

Finds the point of intersection between this ray and an object.

PARAMETERS:

{B.Math.Plane | B.Math.Triangle | B.Math.AABox | B.Math.Sphere} object

{B.Math.Vector3} [point]

point of intersection

RETURNS:

{number | null}

distance from origin or null if no intersections

THROWS:

{Error}

if the object argument has unsupported type

distanceTo(object)

Calculates the shortest distance between this ray and an object.

PARAMETERS:

RETURNS:

{number}

distance

THROWS:

{Error}

if the object argument has unsupported type

equal(ray)

Checks for strict equality of this ray and another ray.

PARAMETERS:

{B.Math.Ray} ray

RETURNS:

{boolean}

PROPERTIES:

METHODS: