Skip to content
brep-conformancegithub

slab

Constructors · api.md § slab · all operations

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}
FunctionFieldsReturns
boxframe, sizeSolid
cylinderframe, radius, heightSolid
sphereframe, radiusSolid
torusframe, major, minorSolid
coneframe, bottom, top, heightSolid
extrudeframe, profile, heightSolid
revolveframe, profile, angleSolid
screwframe, profile, rise, angleSolid
loftframe, profile, scale, height, topSolid
loft_throughframe, profiles, heightsSolid
sweepframe, profile, pathSolid
sweep_pathframe, profile, path, twistSolid
slabframe, size, knots_u, knots_v, heightsSolid