Skip to content

WasmGPU.math.quat.isZero

Summary

WasmGPU.math.quat.isZero checks whether every component is zero. It is useful for guarding normalization and divide operations.

Syntax

WasmGPU.math.quat.isZero(q: number[]): boolean
const result = wgpu.math.quat.isZero(q);

Parameters

Name Type Required Description
q number[] Yes Quaternion input as [x, y, z, w].

Returns

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

Type Details

type Quat = number[]; // expected length: 4 ([x, y, z, w])

Example

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

const q = [0, Math.sin(Math.PI / 8), 0, Math.cos(Math.PI / 8)];
const result = wgpu.math.quat.isZero(q);
console.log(result);

See Also