Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

geometry.revolve

Spin a cross-section (one curve, or faces) around a world axis: a full turn closes into a solid of revolution, a partial turn leaves two ends that caps can close. The surface is built ring by ring (geometry.rings), each ring one turn step from the one before, cut into triangles and wound outward (the segment of the profile furthest from the axis decides which way). Each point carries uv (x around the ring, y along the run, each 0 to 1), t (the run, 0 to 1) and ringU (around the ring, 0 to 1); the result is shaded with point normals and numbered by id.

Inputs

  • profile (Curves or Surface). The cross-section: a geometry holding one curve (its points are the ring) or faces (their boundary is the ring).
  • axis (String, default "y", one of "x", "y", "z"). Which world axis the profile spins around, through center; the profile's distance from that line becomes the radius of the surface it sweeps.
  • angle (Float, default 360). Degrees the profile is carried around the axis. A whole multiple of 360 wraps the last ring onto the first and closes the surface; anything else leaves two ends. Negative spins the other way.
  • segments (Float, default 32, at least 2). How many turn steps the surface is built from, over the whole angle.
  • center (Vec3, default (0, 0, 0)). The point the spin axis passes through.
  • caps (Bool, default false). true closes the two ends of a partial turn with the cross-section's outline. A full turn closes on itself.

Outputs

  • geometry (Geometry). The surface of revolution.
local vase = g.geometry.revolve({ profile = g.curve.line({ start = vector.create(0.5, 0, 0), finish = vector.create(0.3, 1, 0), segments = 4 }), segments = 24 })