# gRotate: Rotate geometries In EhrmannS/rasterTools: obtain and process earth observation data

## Description

Rotate geoms by a certain angle about a center

## Usage

 1 gRotate(geom, angle, about = c(0, 0), fid = NULL)

## Arguments

 geom [geom] Object of class geom. angle [numeric(1)] the counter-clockwise angle by which geom shall be rotated. about [numeric(2)] the point about which geom shall be rotated. fid [integerish(.)] vector of features that should be rotated.

Rotated geom.

## Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 coords <- data.frame(x = c(30, 60, 60, 40, 10, 40, 20), y = c(40, 40, 60, 70, 10, 20, 40), fid = c(1, 1, 1, 1, 2, 2, 2)) window <- data.frame(x = c(0, 80), y = c(0, 80)) aGeom <- geomPolygon(anchor = coords, window = window, show = TRUE) rotatedGeom <- gRotate(geom = aGeom, angle = 90, about = c(40, 40)) visualise(geom = rotatedGeom) # rotate single objects rotatedTriangle <- gRotate(geom = aGeom, angle = -180, about = c(30, 40), fid = 2) visualise(geom = rotatedTriangle, col = "goldenrod1") # rotate different objects about different centers by different angles rotateMore <- gRotate(geom = aGeom, angle = list(90, -180), about = list(c(40, 40), c(30, 40))) visualise(geom = rotateMore, col = "deeppink")

EhrmannS/rasterTools documentation built on Feb. 4, 2019, 11:22 a.m.