MinkowskiSum {spatstat.geom} | R Documentation |
Minkowski Sum of Windows
Description
Compute the Minkowski sum of two spatial windows.
Usage
MinkowskiSum(A, B)
A %(+)% B
dilationAny(A, B)
Arguments
A , B |
Windows (objects of class |
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, thenA \oplus B
is a shifted copy ofA
. -
If
A
is a square of side lengtha
, andB
is a square of side lengthb
, with sides that are parallel to the coordinate axes, thenA \oplus B
is a square of side lengtha+b
. -
If
A
andB
are discs of radiusr
ands
respectively, thenA \oplus B
is a disc of rediusr+s
. -
If
B
is a disc of radiusr
centred at the origin, thenA \oplus B
is equivalent to the morphological dilation ofA
by distancer
. Seedilation
.
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).
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au
See Also
Examples
B <- square(0.2)
RplusB <- letterR %(+)% B
opa <- par(mfrow=c(1,2))
FR <- grow.rectangle(Frame(letterR), 0.3)
plot(FR, main="")
plot(letterR, add=TRUE, lwd=2, hatch=TRUE, hatchargs=list(texture=5))
plot(shift(B, vec=c(3.675, 3)),
add=TRUE, border="red", lwd=2)
plot(FR, main="")
plot(letterR, add=TRUE, lwd=2, hatch=TRUE, hatchargs=list(texture=5))
plot(RplusB, add=TRUE, border="blue", lwd=2,
hatch=TRUE, hatchargs=list(col="blue"))
par(opa)
plot(cells %(+)% square(0.1))