WasmGPU.geometry.cartesianCurve¶
Summary¶
WasmGPU.geometry.cartesianCurve builds geometry data for a primitive or procedural shape. The returned Geometry can be reused by multiple meshes.
Syntax¶
WasmGPU.geometry.cartesianCurve(descriptor: CartesianCurveDescriptor): Geometry
const result = wgpu.geometry.cartesianCurve(descriptor);
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
descriptor |
CartesianCurveDescriptor |
Yes | Descriptor object that defines the initial configuration for this runtime object. |
Returns¶
Geometry - Generated Geometry object containing vertex/index data and computed bounds.
Type Details¶
CartesianCurveDescriptor¶
type CartesianCurveDescriptor = {
f: (x: number) => number;
xMin?: number;
xMax?: number;
segments?: number;
radius?: number;
radialSegments?: number;
closed?: boolean;
plane?: "xy" | "xz" | "yz";
up?: [number, number, number];
breakOnInvalid?: boolean;
};
CartesianCurveDescriptor Fields¶
| Name | Type | Required | Description |
|---|---|---|---|
f |
(x: number) => number |
Yes | Sampling callback used during procedural curve/surface generation. |
xMin |
number |
No | Numeric input controlling xMin for this operation. |
xMax |
number |
No | Numeric input controlling xMax for this operation. |
segments |
number |
No | Subdivision count controlling tessellation density. |
radius |
number |
No | Radius value used by circular/spherical primitives. |
radialSegments |
number |
No | Radial subdivision count for cylindrical/tube geometries. |
closed |
boolean |
No | Boolean flag that toggles closed behavior. |
plane |
"xy" \| "xz" \| "yz" |
No | Plane in which 2D procedural geometry is embedded (xy, xz, or yz). |
up |
[number, number, number] |
No | Reference up-direction used when generating tube/ribbon frames. |
breakOnInvalid |
boolean |
No | Boolean flag that toggles breakOnInvalid behavior. |
Example¶
const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const descriptor = { f: (x) => Math.sin(x), xMin: -Math.PI, xMax: Math.PI, segments: 128, radius: 0.03 };
const result = wgpu.geometry.cartesianCurve(descriptor);
console.log(result);
See Also¶
- WasmGPU.geometry.box
- WasmGPU.geometry.cartesianSurface
- WasmGPU.geometry.circle
- WasmGPU.geometry.custom
- WasmGPU.geometry.cylinder
- WasmGPU.geometry.ellipse
- WasmGPU.geometry.line
- WasmGPU.geometry.parametricCurve
- WasmGPU.geometry.parametricSurface
- WasmGPU.geometry.plane
- WasmGPU.geometry.point
- WasmGPU.geometry.prism