Builtin Library
README.md
geometry.sweep
Carry a cross-section (one curve, or faces) along every curve of a path geometry in rotation-minimising frames, with twist, taper and optional end caps. One surface per path curve, all in the result. Stations are spaced evenly by arc length; a station's frame is the one before it turned by the bend between them (geometry.transport), so the profile keeps its orientation through an S-bend, and a closed path spreads the twist it gathered over its stations so its ring meets itself. The faces wind outward whichever way the profile was drawn. 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), read bygeometry.profile.path(Curves). The curves to sweep along. Every curve the geometry holds gets its own surface.steps(Float, default 24, at least 2). How many cross-sections are placed along each curve, spaced evenly by arc length.twist(Float, default 0). Degrees the cross-section rotates about the path between the first station and the last, spread evenly over the run.scaleStart(Float, default 1). The cross-section's scale at the first station; the stations between interpolate linearly toscaleEnd.scaleEnd(Float, default 1). The cross-section's scale at the last station.caps(Bool, default false). true closes both ends of every open path curve with the cross-section's outline.plane(String, default "xz", one of "xz", "xy", "yz"). Which two of the profile's own axes lie in the cross-section; the remaining axis rides along the path tangent. "xz" reads x and z and sends y along the path, "xy" reads x and y and sends z, "yz" reads y and z and sends x.up(Vec3, default (0, 1, 0)). Seeds the orientation of the first station: the part of this direction square to the path's starting tangent becomes the cross-section's up there.
Outputs
geometry(Geometry). The swept surfaces.
local tube = g.geometry.sweep({ profile = g.curve.circle({ radius = 0.1, segments = 12 }), path = g.curve.line({ finish = vector.create(0, 2, 0), segments = 4 }), steps = 8, caps = true })