ray.pointAt

The point at parameter t along a ray: origin + t · direction.

Value helperSince 0.3.0

Usage

TypeScript
Ray.pointAt(r: Ray, t: number): Point3

Parameters

  • rRay

    The ray. Required. In model.

  • tnumber

    The parameter, in units of the direction’s length; a distance when the direction has length 1. Negative values are not rejected.

    Required

Returns

The point origin + t · direction; NaN when a coordinate is NaN or two infinities cancel.

Example

TypeScript
Ray.pointAt(Ray.of(Point3.of(1, 0, 0), Vector3.of(0, 2, 0)), 1.5) // → { x: 1, y: 3, z: 0 }

See also