# MinkowskiSum

0th

Percentile

##### Minkowski Sum of Windows

Compute the Minkowski sum of two spatial windows.

Keywords
spatial, math
##### Usage
MinkowskiSum(A, B)A %(+)% BdilationAny(A, B)
##### Arguments
A,B

Windows (objects of class "owin"), point patterns (objects of class "ppp") or line segment patterns (objects of class "psp") in any combination.

##### Details

The operator A %(+)% B and function MinkowskiSum(A,B) are synonymous: they both compute the Minkowski sum of the windows A and B. The function dilationAny computes the Minkowski dilation A %(+)% reflect(B).

The Minkowski sum of two spatial regions $A$ and $B$ is another region, formed by taking all possible pairs of points, one in $A$ and one in $B$, and adding them as vectors. The Minkowski Sum $A \oplus B$ is the set of all points $a+b$ where $a$ is in $A$ and $b$ is in $B$. A few common facts about the Minkowski sum are:

• The sum is symmetric: $A \oplus B = B \oplus A$.

• If $B$ is a single point, then $A \oplus B$ is a shifted copy of $A$.

• If $A$ is a square of side length $a$, and $B$ is a square of side length $b$, with sides that are parallel to the coordinate axes, then $A \oplus B$ is a square of side length $a+b$.

• If $A$ and $B$ are discs of radius $r$ and $s$ respectively, then $A \oplus B$ is a disc of redius $r+s$.

• If $B$ is a disc of radius $r$ centred at the origin, then $A \oplus B$ is equivalent to the morphological dilation of $A$ by distance $r$. See dilation.

The Minkowski dilation is the closely-related region $A \oplus (-B)$ where $(-B)$ is the reflection of $B$ through the origin. The Minkowski dilation is the set of all vectors $z$ such that, if $B$ is shifted by $z$, the resulting set $B+z$ has nonempty intersection with $A$.

The algorithm currently computes the result as a polygonal window using the polyclip library. It will be quite slow if applied to binary mask windows.

The arguments A and B can also be point patterns or line segment patterns. These are interpreted as spatial regions, the Minkowski sum is computed, and the result is returned as an object of the most appropriate type. The Minkowski sum of two point patterns is another point pattern. The Minkowski sum of a point pattern and a line segment pattern is another line segment pattern.

##### Value

A window (object of class "owin") except that if A is a point pattern, then the result is an object of the same type as B (and vice versa).

dilation, erosionAny

• MinkowskiSum
• %(+)%
• dilationAny
##### Examples
# NOT RUN {
B <- square(0.2)
RplusB <- letterR %(+)% B

opa <- par(mfrow=c(1,2))
FR <- grow.rectangle(Frame(letterR), 0.3)
plot(FR, main="")
plot(shift(B, vec=c(3.675, 3)),
plot(FR, main="")