Expand description
Swept disks along chains of straight segments and circular arcs (#232).
A pipe run, a rebar or a cable tray edge is a disk swept along legs
joined by bends: authoring formats write it as a disk swept along a
composite of lines and arcs, or along a polyline whose corners are
rounded to a fillet radius.
swept_disk_along_pieces meshes both so that every point of the
exact tube lies within the chord budget of the triangles.
§The bound
Each piece is bounded on its own, with the split crate::sweep uses
for one arc (#231): half the budget c chords the disk, so a ring of
n points inscribed in the circle of radius r lies within
r (1 - cos(pi/n)) <= c/2 of it, and every point of the exact tube is
within c/2 of the tube the ring polygon traces when it is carried
rigidly along the exact centreline by the piece’s own frames (each
exact section circle and its polygon lie in the same plane). The
other half bounds that polygon tube against the triangles:
- Along a segment the frames do not turn, so the polygon tube is a prism whose walls are the mesh’s own planar rectangles: zero.
- Along an arc of radius
Rthe frames are rotation-minimising, which along a circle means they turn with it: consecutive stations are rotations of one ring about the arc’s axis, and the ring’s plane contains that axis. The polygon tube between two stations is then the revolutioncrate::revolvebounds, and its triangles are within(R + r)(1 - cos(phi/2))of it for a stepphi: the sagitta of the outer side of the bend, not of the centreline. Its wall quads are planar trapezoids, so their twist adds nothing; the span boundcrate::sweepcomputes, directrix sagitta plus the section’s reach pluscrate::loft’s quad bound, is exactly that sum here. The step halves until every span fitsc/2; more than 4096 steps on a bend is refused withBudgetExceeded.
§Joints
Consecutive pieces share one station, so the walls meet watertight and
wound one way: the incoming piece’s end section. The outgoing piece’s
own start frame is that frame turned by the least rotation that takes
the incoming tangent to the outgoing one, moved to its start point, and
its stations follow from it. Where the pieces are tangent continuous
and meet, the two frames coincide. Where they turn by theta or leave
a gap g, every vertex of the shared station lies at most
delta <= g + 2 r sin(theta/2) from the station the outgoing piece’s
bound was proved for; moving a triangle’s vertices by at most delta
moves each of its points by at most delta (same barycentric weights),
so the first span of the outgoing piece adds the measured delta to its
bound and is refined until the sum fits.
A swept disk along a directrix that is not tangent continuous is undefined (the section has no single plane at a corner), so a joint turning by more than
theta_max = 2 asin(c / (8 r)) (pi once c >= 8 r)
is a corner and is refused by name: at that turn the shared section
leans off the outgoing piece’s own by a quarter of the budget, and any
larger turn would be a kink no chord budget can hide. A turn at or below
it is tangent continuous at the requested accuracy and costs at most
c/4 of the directrix’s half. A gap above c/4 is refused too.
§Fillets
A fillet radius f rounds every corner between two straight segments
(the swept disk’s fillet_radius): a corner turning by
theta is replaced by the arc of radius f tangent to both segments,
which cuts f tan(theta/2) off each. Segments shortened to nothing are
dropped (two fillets then meet tangentially). Refused by name: a fillet
that needs more of a segment than it has, a corner beside an arc (only
corners between straight segments are rounded), a disk radius at or
above the fillet radius, or any bend radius, whose tube folds through
the bend’s axis on its inside (equality is a horn torus, which some
formats permit but which bounds no two-manifold solid), and a reversal.
Enums§
- Path
Piece - One smooth piece of a swept disk’s directrix.
Functions§
- joint_
tolerance - The largest turn a joint may make and still be tangent continuous at
chord budget
chordfor a disk of radiusradius:2 asin(c / (8 r))(see the module notes). - swept_
disk_ along_ pieces - Sweep a disk, optionally hollow, along a chain of segments and arcs so
that every point of the exact tube lies within
chordof the mesh.