point3.at

The point stored at a given index in a flat position array.

Value helperSince 0.3.0

Usage

TypeScript
Point3.at(flat: ArrayLike<number>, i: number): Point3

Parameters

  • flatArrayLike<number>

    Positions packed as [x0, y0, z0, x1, …] (a Float64Array, a plain array or the raw tier’s output). Required. In model.

  • inumber

    Point index: the point occupies flat[3i], flat[3i + 1], flat[3i + 2].

    Required

Returns

The point at index i. An index past the end gives undefined coordinates (no bounds check).

Example

TypeScript
Point3.at([0, 0, 0, 4, 5, 6], 1) // → { x: 4, y: 5, z: 6 }

See also