WasmGPU.math.mat4.normalize¶
Summary¶
WasmGPU.math.mat4.normalize scales the input to unit length when possible. Use it before angle, lighting, and direction-sensitive computations.
Syntax¶
WasmGPU.math.mat4.normalize(matr: number[]): number[]
const result = wgpu.math.mat4.normalize(matr);
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
matr |
number[] |
Yes | Input 4x4 matrix (16 numbers in column-major order) used by this operation. |
Returns¶
number[] - New 4x4 matrix as a 16-number column-major array.
Type Details¶
Example¶
const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const matr = wgpu.math.mat4.translate(wgpu.math.mat4.identity(), [1, 2, 3]);
const result = wgpu.math.mat4.normalize(matr);
console.log(result);