Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

geometry.extrude

Push faces out along their own normals or along a vector, walling the gap they leave into a closed solid: the selected faces move, a copy of them left behind closes the volume (when cap is on), and each border edge of the selection grows a side wall of two triangles. Every emitted face is wound toward the side it faces, so a negative distance gives the mirrored solid with its normals still outward. The faces outside the group stay where they are. The result is shaded with point normals and numbered by id.

Inputs

  • geometry (Surface). The surface whose faces are pushed out.
  • distance (Float, default 1). How far the selected faces travel. Negative travels the other way and still comes back as a solid facing outwards. 0 moves no face, and is refused.
  • offset (Float, default 0). How far the surface the extrusion starts from stands from the input surface, along the direction of travel. 0 starts at the input surface.
  • direction (String, default "normal", one of "normal", "vector"). What each point travels along. "normal" uses the surface normal at that point, averaged over the selected faces meeting there, so a curved selection fans out. "vector" moves every point along vector, so the selection travels rigidly.
  • vector (Vec3, default (0, 1, 0)). The direction of travel when direction is "vector". Used as given, so its length multiplies distance; a vector of (0, 0, 0) moves no face, and is refused.
  • group (String, default ""). Names a 0/1 attribute on class holding the faces to push; left empty, every face is pushed. A group holding no face is refused.
  • class (String, default "primitive", one of "point", "primitive", "vertex"). The class group lives on. A "primitive" group is read once per face; a "point" or "vertex" group selects a face only when every one of its corners is above threshold (geometry.selected).
  • threshold (Float, default 0.5). The value a group element must exceed to count as a member.
  • cap (Bool, default true). true leaves a copy of the selected faces behind, wound the other way, so the volume is closed at both ends. false leaves that end open.
  • epsilon (Float, default 0.00001, above 0). Points this close together are treated as one while border edges are paired and normals averaged, which lets a triangle soup extrude as the connected surface it looks like.

Outputs

  • geometry (Geometry). The extruded surface.
local slab = g.geometry.extrude({ geometry = g.mesh.grid({ size = { x = 2, z = 2 } }), distance = 0.25 })