sources.plane

A flat grid in the XZ plane, width along x and height along z, of quads facing +Y with persistent ids.

GeometricSince 0.15.0

Usage

TypeScript
Sources.plane(params?: SourcePlaneParams): Result<Geometry>

Parameters

  • params.widthnumber

    Extent along x. Default 1. In model.

  • params.heightnumber

    Extent along z. Default 1. In model.

  • params.widthSegmentsnumber

    Cells along x; an integer. Default 1. Range [1, 1024] count.

  • params.heightSegmentsnumber

    Cells along z; an integer. Default 1. Range [1, 1024] count.

  • params.scopestring

    The host’s node id; ids are minted under it. Default undefined (index ids, minter 0).

Returns

Ok with polygon geometry of (widthSegments + 1) · (heightSegments + 1) points row by row from (−x, −z) and widthSegments · heightSegments quads; no N.

Errors

Guarantees

  • the area equals width · height and every quad’s normal is +Y
  • the same parameters give the same bytes (geometryContentHash), natively and in WASM
  • The same result on every machine.

Example

TypeScript
const r = Sources.plane({ width: 4, height: 2, widthSegments: 4, heightSegments: 2 })
r.ok || r.diagnostics[0].code // → 15 points and 8 quads once loadGeometryKernel() has run