# intersect.owin

0th

Percentile

##### Intersection, Union or Set Subtraction of Two Windows

Yields the intersection, union or set subtraction of two windows.

Keywords
spatial, math
##### Usage
intersect.owin(A, B, ..., fatal=TRUE)
union.owin(A,B, ...)
setminus.owin(A,B, ...)
##### Arguments
A
A window object (see Details).
B
A window object.
...
Optional arguments passed to as.mask to control the discretisation, if required.
fatal
Logical. Determines what happens if the intersection is empty.
##### Details

The function intersect.owin computes the intersection between the two windows A and B, while union.owin computes their union. The function setminus.owin computes the intersection of A with the complement of B.

The arguments A and B must be window objects (either objects of class "owin", or data that can be coerced to this class by as.owin).

If the intersection is empty, then if fatal=FALSE the result is NULL, while if fatal=TRUE an error occurs.

The intersection or union of more than two windows can also be computed. For intersect.owin and union.owin the arguments ... can include additional window objects.

##### Value

• A window (object of class "owin").

is.subset.owin, overlap.owin, boundingbox, owin.object

##### Aliases
• intersect.owin
• union.owin
• setminus.owin
##### Examples
# rectangles
u <- unit.square()
v <- owin(c(0.5,3.5), c(0.4,2.5))
# polygon
data(letterR)

# two rectangles
intersect.owin(u, v)
union.owin(u,v)
setminus.owin(u,v)

# polygon and rectangle
intersect.owin(letterR, v)
union.owin(letterR,v)
setminus.owin(letterR,v)

intersect.owin(m, v)
union.owin(m,v)
setminus.owin(m,v)

p <- rotate(v, 0.2)
intersect.owin(m, p)
union.owin(m,p)
setminus.owin(m,p)

# two polygons
A <- letterR
B <- rotate(letterR, 0.2)
plot(boundingbox(A,B), main="intersection")
w <- intersect.owin(A, B)

plot(boundingbox(A,B), main="union")
w <- union.owin(A,B)

plot(boundingbox(A,B), main="set minus")
w <- setminus.owin(A,B)
plot(intersect.owin(A,B,C))