
Last chance! 50% off unlimited learning
Sale ends in
Spin (rotate) the geometry of a SpatVector.
# S4 method for SpatVector
spin(x, angle, x0, y0)
SpatVector
SpatVector
numeric. Angle of rotation in degrees
numeric. x-coordinate of the center of rotation. If missing, the center of the extent of x
is used
numeric. y-coordinate of the center of rotation. If missing, the center of the extent of x
is used
rescale
, t
, shift
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
w <- spin(v, 180)
plot(v)
lines(w, col="red")
# lower-right corner as center
e <- as.vector(ext(v))
x <- spin(v, 45, e[1], e[3])
Run the code above in your browser using DataLab