Another possibility is to use TransformedRegion
with RegionProduct
. Here is a function that does this:
Options[MinkowskiSum] = Options[BoundaryDiscretizeRegion];
MinkowskiSum[r1_, r2_, opts:OptionsPattern[]] := Module[{d1, d2, vfunc,bounds},
d1 = RegionEmbeddingDimension[r1];d1=RegionEmbeddingDimension[r1];
d2 = RegionEmbeddingDimension[r2];d2=RegionEmbeddingDimension[r2];
(
v = Evaluate[Array[Slotfunc=Evaluate[Array[Slot, 3]d1] + Array[Slot, 3d1, 4]]&;d1+1]]&;
BoundaryDiscretizeRegion[bounds=RegionBounds[r1]+RegionBounds[r2];
Quiet[
TransformedRegion[ BoundaryDiscretizeRegion[
RegionProduct[r1TransformedRegion[RegionProduct[r1, r2], func],
vbounds,
opts
],
optsBoundaryDiscretizeRegion::brepl
]
) /; d1 === d2d1===d2
]
Your examples:
MinkowskiSum[Circle[{0,0}, 1], Line[{{0,0},{3,5}}], Axes->True, ImageSize->200]
MinkowskiSum[
Sphere[{0,0,0}, 1],
Line[{{0,0,0},{3,5,4}}],
Axes->True,
ImageSize->200
]