Hulls
Compute the convex hull of a set of 2D or 3D geometries. Useful for creating smooth blends between shapes or building complex convex forms from simpler primitives. hullChain produces a smooth sweep through a series.
See also:
function hull(...geometries: AnyGeom[]): AnyGeomCompute the convex hull of two or more geometries.
The result is the smallest convex shape that encloses all input geometries. All inputs must be the same dimension (all Geom2 or all Geom3).
Parameters:
| Name | Type | Description |
|---|---|---|
geometries |
— | Two or more geometry objects to hull. |
Returns: A convex Geom2 or Geom3 enclosing all inputs.
const { sphere, translate } = { ...jscad.primitives, ...jscad.transforms }const { hull } = jscad.hullsasync function main() { const a = sphere({ radius: 3 }) const b = translate([10, 0, 0], sphere({ radius: 1 })) return hull(a, b)}See also:
hullChain
Section titled “hullChain”function hullChain(...geometries: AnyGeom[]): AnyGeomCompute a chain of convex hulls between consecutive pairs of geometries.
Hulls each adjacent pair — hull(g0, g1), hull(g1, g2), … — and unions the results. Useful for creating smooth organic sweeps along a path of shapes.
Parameters:
| Name | Type | Description |
|---|---|---|
geometries |
— | Three or more geometry objects to chain-hull. |
Returns: A Geom2 or Geom3 formed by unioning consecutive pairwise hulls.
const { sphere, cube } = jscad.primitivesconst { translate } = jscad.transformsconst { hullChain } = jscad.hullsasync function main() { return hullChain( sphere({ radius: 3 }), translate([8, 0, 4], cube({ size: 2 })), translate([16, 0, 0], sphere({ radius: 3 })) )}See also: