Skip to content

WasmGPU.math.vec3.isParallel

Summary

WasmGPU.math.vec3.isParallel checks whether two vectors are parallel (same or opposite direction). It is useful for degeneracy checks in geometry code.

Syntax

WasmGPU.math.vec3.isParallel(v1: number[], v2: number[]): boolean
const result = wgpu.math.vec3.isParallel(v1, v2);

Parameters

Name Type Required Description
v1 number[] Yes First vector input as [x, y, z].
v2 number[] Yes Second 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 v1 = [1, -1, 0.5];
const v2 = [0, 1, 0];
const result = wgpu.math.vec3.isParallel(v1, v2);
console.log(result);

See Also