unitVector
unitVector(
dimensions?):Point
Defined in: src/geometry.ts:30
A uniform direction in dimensions dimensions, as a unit vector.
Normalised Gaussians, which is the only construction that stays uniform on the sphere in every dimension. Picking each coordinate uniformly and normalising concentrates points toward the corners of the cube.
Parameters
Section titled “Parameters”dimensions?
Section titled “dimensions?”number = 2
Returns
Section titled “Returns”Example
Section titled “Example”unitVector(); // [ -0.6018, 0.7986 ] length 1unitVector(3); // [ 0.2673, -0.5345, 0.8018 ]