Skip to content

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.

number = 2

Point

unitVector(); // [ -0.6018, 0.7986 ] length 1
unitVector(3); // [ 0.2673, -0.5345, 0.8018 ]