Compute the Minkowski sum of two spatial windows.
MinkowskiSum(A, B)A %(+)% B
dilationAny(A, B)
Windows (objects of class "owin"
),
point patterns (objects of class "ppp"
)
or line segment patterns (objects of class "psp"
)
in any combination.
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).
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
The sum is symmetric:
If
If
If
If dilation
.
The Minkowski dilation is the closely-related region
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.
# 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(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))
# }
Run the code above in your browser using DataLab