geo_reflect: Reflect geometric objects

View source: R/geo_reflect.R

geo_reflectR Documentation

Reflect geometric objects

Description

Reflect geometric objects across a reflection axis.

Usage

geo_reflect(obj, angle, fid = NULL, update = TRUE)

Arguments

obj

gridded(1)
the object to reflect.

angle

numeric(1)
the counter-clockwise angle by which the reflection axis shall be rotated (can be negative to rotate clockwise).

fid

integerish(1)
in case only a subset of features shall be rotated, specify that here.

update

logical(1)
whether or not to update the window slot after rotation.

Details

The reflection axis is a straight line that goes through the plot origin with the given angle, where positive angles open towards the positive y-axis and negative angles open up towards the negative y-axis.

Value

geom of the reflected obj.

See Also

Other geometry tools: geo_filter(), geo_locate(), geo_pull(), geo_rotate(), geo_scale(), geo_skew(), geo_stretch(), geo_translate()

Examples

# reflect several features
geo_vis(gtGeoms$polygon, linewidth = 3)
newPoly <- geo_reflect(obj = gtGeoms$polygon, angle = 45,
                       update = FALSE)
geo_vis(newPoly, linecol = "green", new = FALSE)

# reflect a single feature
geo_vis(gtGeoms$polygon, linewidth = 3)
newPoly <- geo_reflect(obj = gtGeoms$polygon, angle = 90, fid = 2,
                       update = FALSE)
geo_vis(newPoly, linecol = "green", new = FALSE)

EhrmannS/geometr documentation built on Jan. 31, 2024, 9:13 a.m.