WasmGPU.math.vec3.neg¶
Summary¶
WasmGPU.math.vec3.neg negates each component of the input. Use it to flip direction or sign while preserving magnitudes.
Syntax¶
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
v |
number[] |
Yes | Vector input as [x, y, z]. |
Returns¶
number[] - New 3D vector as [x, y, z].
Type Details¶
Example¶
const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const v = [1, 2, 3];
const result = wgpu.math.vec3.neg(v);
console.log(result);