Skip to content

WasmGPU.math.vec3.isNormalized

Summary

WasmGPU.math.vec3.isNormalized checks whether the input has unit length under the engine tolerance. Use it to validate inputs to rotation-sensitive code.

Syntax

WasmGPU.math.vec3.isNormalized(v: number[]): boolean
const result = wgpu.math.vec3.isNormalized(v);

Parameters

Name Type Required Description
v number[] Yes Vector input as [x, y, z].

Returns

boolean - Boolean flag indicating whether the tested condition is satisfied.

Type Details

type Vec3 = number[]; // expected length: 3 ([x, y, z])

Example

const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);

const v = [1, 2, 3];
const result = wgpu.math.vec3.isNormalized(v);
console.log(result);

See Also