For convex polygons the sum is convex, has at most vertices, and is computed in by merging the two edge sequences by angle.

PropertyValue
commutative, associative
convexitypreserved
vertex count (convex)
perimeter
area (mixed area, Steiner formula)
translation by
offset polygon with rounded corners: perimeter , area
non-convex inputscomplexity up to ; decompose into convex pieces, sum pairwise, take the union (rarely needed)

The construction

  1. Rotate each polygon (CCW) so that its bottom-most, then left-most, vertex is first.
  2. Merge the two edge sequences by polar angle, as in merge sort (equal angles advance both).
  3. Accumulate the edge vectors starting from the sum of the two first vertices.
vector<P> minkowski(vector<P> a, vector<P> b) {       // both CCW, both starting at the lowest point
    a.push_back(a[0]); a.push_back(a[1]);
    b.push_back(b[0]); b.push_back(b[1]);
    vector<P> res;
    size_t i = 0, j = 0;
    while (i + 2 < a.size() || j + 2 < b.size()) {
        res.push_back(a[i] + b[j]);
        long long c = cross(a[i+1] - a[i], b[j+1] - b[j]);
        if (c >= 0 && i + 2 < a.size()) i++;
        if (c <= 0 && j + 2 < b.size()) j++;
    }
    return res;
}

Uses

ProblemFormulation
collision detection (basis of GJK in physics engines)
distance between convex polygonsdistance from the origin to
motion planning for a translating robot grow each obstacle by , move a point
maximum of over convex sets for linear support function of the sum
reachable set after two movessum of the two move sets
max-plus convolution of concave sequencesmerge of the slope sequences (below)
widest empty corridorvia Minkowski differences

The collision test is a point-in-convex-polygon query on the Minkowski difference: to build, per query (Convex Polygon Queries).

Max-plus convolution of concave sequences

For concave and (non-increasing differences), is obtained by merging the difference sequences in decreasing order, instead of . This speeds up “combine two convex DP tables” steps (for example in tree knapsack with concave values). Without concavity no subquadratic algorithm is known.

vector<long long> maxPlusConcave(const vector<long long>& f, const vector<long long>& g) {  // f, g concave
    int n = sz(f), m = sz(g); vector<long long> h{f[0] + g[0]};
    int i = 0, j = 0;
    while (i + 1 < n || j + 1 < m) {                 // take the larger next increment (merge of slopes)
        if (j + 1 == m || (i + 1 < n && f[i + 1] - f[i] >= g[j + 1] - g[j])) i++; else j++;
        h.push_back(f[i] + g[j]);
    }
    return h;
}

Related: Convex Hull, Rotating Calipers.