gt_reflect: Reflect geometric objects

Description Usage Arguments Details Value See Also Examples

View source: R/gt_reflect.R

Description

Reflect geometric objects across a reflection axis.

Usage

1
gt_reflect(obj, angle, fid = NULL, update = TRUE)

Arguments

obj

[geometric object(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(.)]
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: gt_filter(), gt_locate(), gt_pull(), gt_rotate(), gt_scale(), gt_skew(), gt_stretch(), gt_translate()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# reflect several features
visualise(gtGeoms$polygon, linewidth = 3)
newPoly <- gt_reflect(obj = gtGeoms$polygon, angle = 45,
                      update = FALSE)
visualise(newPoly, linecol = "green", new = FALSE)

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

geometr documentation built on Sept. 21, 2021, 1:07 a.m.