slab
Constructors · api.md § slab · all operations
definition
slab(frame: Frame, size: Length[2], knots_u, knots_v: list<Number>, heights: list<list<Length>>) -> Solid
Makes a block with a freeform top. The block is flat underneath and on its four sides, and its top is a smooth surface.
The result is the set of points over the rectangle 0 ≤ u ≤ size[0], 0 ≤ v ≤ size[1] from w = 0 up to the height field w = f(u/size[0], v/size[1]). f is the bicubic B-spline over [0, 1]² with clamped knots knots_u, knots_v (each running four times 0 first and four times 1 last) and coefficients heights[i][j]. Every height must be positive, which keeps f positive. As a surface, the top is the B-spline whose control points sit at the knots' Greville abscissae times the size, so the top's x and y run linearly with its parameters. The result's volume and moments are integrals of polynomials in f, and its area is the integral of √(1 + (f_u/size[0])² + (f_v/size[1])²).
Example.
> {"cmd": "slab", "frame": {"origin": [0, 0, 0], "x": [1, 0, 0], "y": [0, 1, 0], "z": [0, 0, 1]},
"size": [10, 10], "knots_u": [0, 0, 0, 1, 1, 1], "knots_v": [0, 0, 0, 1, 1, 1],
"heights": [[5, 5, 5], [5, 7, 5], [5, 5, 5]]}
< {"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 |