s2intersect: Intersection or union of two spherical regions

View source: R/s2region.R

s2intersectR Documentation

Intersection or union of two spherical regions

Description

Intersection or union of two objects of class "s2region".

Usage

s2intersect(x, y, options = s2::s2_options())

Arguments

x, y

Region on the sphere of class "s2region".

options

List of class "s2_options" to control how borders are treated polygonal regions. See s2::s2_options for available options and details.

Value

Region on the sphere of class "s2region".

Examples

loop1 <- cbind(lon = c(0,60,60,0), lat = c(-40,-40,40,40))
loop2 <- cbind(lon = c(30,90,90,30), lat = c(-40,-40,40,40))
poly1 <- s2polygon(loop1)
poly2 <- s2polygon(list(loop2))
poly3 <- s2intersect(poly1, poly2)
poly4 <- s2union(poly1, poly2)
plot(poly1, eye = c(lon=45, lat=0), col = "red", eps = pi/100)
plot(poly2, col = "green", add = TRUE, eps = pi/100)
plot(poly3, col = "blue", add = TRUE, eps = pi/100)
plot(poly4, col = "cyan", eps = pi/100)

spatstat/spatstat.sphere documentation built on Jan. 27, 2023, 2:59 a.m.