WasmGPU.math.quat.normsq¶
Summary¶
WasmGPU.math.quat.normsq returns squared Euclidean norm. It avoids the square root cost when only relative length comparison is needed.
Syntax¶
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
q |
number[] |
Yes | Quaternion input as [x, y, z, w]. |
Returns¶
number - Squared Euclidean norm of the input.
Type Details¶
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.normsq(q);
console.log(result);