sweep_path
Constructors · api.md § sweep_path · all operations
definition
sweep_path(frame: Frame, profile: Profile, path: Spline3, twist: Angle) -> Solid
Carries a profile along a smooth space curve, like a bent pipe or a twisted rib.
path is a clamped B-spline in the frame's coordinates, given by its degree, knots and control points. The path starts at the origin heading along z, with the profile in the xy plane square to it. twist may be any angle, either way round. The profile's plane stays square to the path. The profile's axes follow the path's rotation-minimizing frame, which never turns about the tangent. The axes also turn by twist more by the end of the path, evenly in arc length. Every profile point must be closer to the path than the path's least radius of curvature, and the sweep must never meet itself.
Let T be the tangent, and let K₁, K₂ be the curvature along the profile's turned axes. A profile point (X, Y) then sweeps a volume element (1 − K₁X − K₂Y) dA ds. The volume and moments are therefore integrals along the path of the profile's moments up to the third. The side's element is √(a²|b′|² + φ′²(b·b′)²) along the boundary b, where a = 1 − K₁X − K₂Y and φ′ is the twist per length. A profile centred on the path gives volume A·ℓ (Pappus), where ℓ is the path's length. If that profile is also untwisted, the side is L·ℓ.
Example.
> {"cmd": "sweep_path", "frame": {"origin": [0, 0, 0], "x": [1, 0, 0], "y": [0, 1, 0],
"z": [0, 0, 1]}, "profile": [[{"line": [[-1, -1], [1, -1]]}, {"line": [[1, -1], [1, 1]]},
{"line": [[1, 1], [-1, 1]]}, {"line": [[-1, 1], [-1, -1]]}]],
"path": {"degree": 3, "knots": [0, 0, 0, 0, 1, 1, 1, 1], "ctrl": [[0, 0, 0], [0, 0, 5],
[3, 0, 10], [8, 0, 12]]}, "twist": 0}
< {"ok": 1}common to constructors
| Function | Fields | Returns |
|---|---|---|
box | frame, size | Solid |
cylinder | frame, radius, height | Solid |
sphere | frame, radius | Solid |
torus | frame, major, minor | Solid |
cone | frame, bottom, top, height | Solid |
extrude | frame, profile, height | Solid |
revolve | frame, profile, angle | Solid |
screw | frame, profile, rise, angle | Solid |
loft | frame, profile, scale, height, top | Solid |
loft_through | frame, profiles, heights | Solid |
sweep | frame, profile, path | Solid |
sweep_path | frame, profile, path, twist | Solid |
slab | frame, size, knots_u, knots_v, heights | Solid |