Documentation
    Preparing search index...

    Function extrudeGeometry

    • A 2D outline extruded linearly along Z, centred on the origin (§53 "extrusion").

      const geometry = extrudeGeometry({
      shape: [{ x: -1, y: -0.2 }, { x: 1, y: -0.2 }, { x: 1, y: 0.2 }, { x: -1, y: 0.2 }],
      depth: 0.1,
      });

      Along Z, not Y, because the outline is authored in the XY plane that §7a makes the 2D plane of this engine: an extruded logo, gear tooth, or panel profile is drawn flat and given thickness towards the viewer, and one that has to stand up is rotated by its node. The solid spans [-depth/2, depth/2].

      Each outline edge becomes its own quad with its own normal — four vertices, not two shared ones — because an extruded profile's edges are meant to look like edges; smoothing them would round a gear tooth. The outward normal of edge a → b is (b − a) turned a quarter turn, which for a counter-clockwise outline points out of the solid (the builder normalizes either input winding to counter-clockwise first).

      The caps are ear-clipped by §52's tessellator (tessellation.ts), which is what makes a concave outline — an L, a star, a gear tooth, a letter — cap correctly. Until 2026-08-09 this paragraph read:

      The caps are a centroid fan, which is exact for a convex outline and folds over itself for a concave one — so a concave outline with capped: true is rejected (§85) rather than drawn wrongly. §52 makes tessellation an isolated, replaceable module of this package with a stable interface; when it lands, this restriction lifts and nothing else here changes.

      §52's module landed, and that is what happened: the fan and its centroid vertex are gone, one call to triangulatePolygon replaced them, and a capped extrusion now carries 2n cap vertices rather than 2(n + 1). The same index list drives both caps (§52 "index-buffer reuse"), reversed for the -Z end so both face outwards. What is still refused is what the tessellator refuses — a self-intersecting outline, and one enclosing no area — because §52's "self-intersections where well-defined" tier needs a fill rule and a planar-subdivision pass this release does not ship, and refusing loudly beats emitting overlapping triangles (§85). capped: false has no restriction beyond finiteness: the side walls are correct for any outline.

      A cap with holes — a washer, an O — is not offered here: the hole would need its own inward-facing side walls, which is a §50 shape-node question rather than a §53 primitive one. triangulatePolygon already takes holes, and polygonGeometry2D is the builder that uses them (staged, 2026-08-09).

      Uv: the side wall's u is arc length around the outline normalized to the perimeter, v runs 0 at -Z to 1 at +Z; each cap's uv is the outline's own bounding box normalized to [0, 1]².

      Parameters

      Returns BufferGeometry