# intersect.owin

From spatstat v1.6-9
by Adrian Baddeley

##### Intersection or Union of Two Windows

Yields the intersection or union of two windows.

- Keywords
- spatial

##### Usage

```
intersect.owin(A, B)
union.owin(A,B)
```

##### Arguments

- A
- A window object (see Details).
- B
- A window object.

##### Details

The function `intersect.owin`

computes the intersection between the
two windows `A`

and `B`

, while
`union.owin`

computes their union.

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`

).

At present the intersection or union of two polygons is computed by discretising them, yielding a binary image mask. If the intersection is empty, an error occurs.

##### Value

- A window object.

##### See Also

##### Examples

```
# rectangles
u <- unit.square()
v <- owin(c(0.5,3.5), c(0.4,2.5))
# polygon
data(letterR)
# mask
m <- as.mask(letterR)
# two rectangles
intersect.owin(u, v)
union.owin(u,v)
# polygon and rectangle
intersect.owin(letterR, v)
union.owin(letterR,v)
# mask and rectangle
intersect.owin(m, v)
union.owin(m,v)
#
A <- letterR
B <- rotate(letterR, 0.2)
plot(bounding.box(A,B), main="intersection")
w <- intersect.owin(A, B)
plot(w, add=TRUE)
plot(A, add=TRUE)
plot(B, add=TRUE)
plot(bounding.box(A,B), main="union")
w <- union.owin(A,B)
plot(w, add=TRUE)
plot(A, add=TRUE)
plot(B, add=TRUE)
```

*Documentation reproduced from package spatstat, version 1.6-9, License: GPL version 2 or newer*

### Community examples

Looks like there are no examples yet.