Skip to content

WasmGPU.geometry.line

Summary

WasmGPU.geometry.line builds geometry data for a primitive or procedural shape. The returned Geometry can be reused by multiple meshes.

Syntax

WasmGPU.geometry.line(length?: number, thickness?: number, plane?: "xy" | "xz" | "yz", doubleSided?: boolean): Geometry
const result = wgpu.geometry.line(length, thickness, plane, doubleSided);

Parameters

Name Type Required Description
length number No Numeric input controlling length for this operation.
thickness number No Numeric input controlling thickness for this operation.
plane "xy" \| "xz" \| "yz" No Plane in which 2D procedural geometry is embedded (xy, xz, or yz).
doubleSided boolean No Boolean flag that toggles doubleSided behavior.

Returns

Geometry - Generated Geometry object containing vertex/index data and computed bounds.

Type Details

// No additional descriptor expansion is required for this signature.

Example

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

const length = 1;
const thickness = 1;
const plane = {};
const doubleSided = true;
const result = wgpu.geometry.line(length, thickness, plane, doubleSided);
console.log(result);

See Also