Skip to content

Minkowski sum operations for 3D geometry. The Minkowski sum A ⊕ B inflates solid A by the shape of solid B — sweeping B through every surface point of A. Common uses: rounding all edges with a sphere, chamfering with a cube, or computing configuration-space obstacles for collision detection.

See also:

function minkowskiSum(geometryA: Geom3, geometryB: Geom3): Geom3

Compute the Minkowski sum of two 3D geometries.

The Minkowski sum A ⊕ B is the set of all points a + b where a ∈ A and b ∈ B. Intuitively, it “inflates” geometry A by the shape of geometry B: sweeping B’s centre through every point on A’s surface and taking the union.

Typical uses:

  • Round all edges and corners of a solid by summing with a small sphere.
  • Chamfer all edges by summing with a small cube.
  • Compute the configuration-space obstacle for collision detection.

Both geometries must be Geom3. The second operand should be convex for best performance; non-convex first operands are supported (via tetrahedra decomposition) as long as the second is convex. Both non-convex is not supported.

Parameters:

Name Type Description
geometryA — The base geometry to inflate.
geometryB — The shape to inflate by (should be convex).

Returns: A new Geom3 representing the Minkowski sum.

const { minkowskiSum } = jscad.minkowski
const { cuboid, sphere } = jscad.primitives
async function main() {
// Round every edge and corner of a box by 1 unit
const box = cuboid({ size: [10, 8, 4] })
const kernel = sphere({ radius: 1, segments: 16 })
return minkowskiSum(box, kernel)
}

See also: