modeling/minkowski

Minkowski sum operations for 3D geometries.

The Minkowski sum of two shapes A and B is the set of all points that are the sum of a point in A and a point in B. This is useful for:

  • Offsetting/inflating shapes (using a sphere creates rounded edges)
  • Collision detection (shapes collide iff their Minkowski difference contains origin)
  • Motion planning and swept volumes
Source:
Example
const { minkowskiSum } = require('@jscad/modeling').minkowski
const rounded = minkowskiSum(cube, sphere)

Methods

(static) minkowskiSum(…geometries) → {geom3}

Source:

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. Geometrically, this "inflates" geometry A by the shape of geometry B.

Common use cases:

  • Offset a solid by a sphere to round all edges and corners
  • Offset a solid by a cube to create chamfered edges
  • Collision detection (if Minkowski sum contains origin, shapes overlap)

For best performance, use convex geometries. Non-convex geometries are supported when the second operand is convex, but require decomposition and are slower.

Example
const { primitives, minkowski } = require('@jscad/modeling')
const cube = primitives.cuboid({ size: [10, 10, 10] })
const sphere = primitives.sphere({ radius: 2, segments: 16 })
const rounded = minkowski.minkowskiSum(cube, sphere)
Parameters:
Name Type Attributes Description
geometries Object <repeatable>

two geom3 geometries (second should be convex for non-convex first)

Returns:

new 3D geometry representing the Minkowski sum

Type
geom3