gt_stretch: Stretch geometric objects

Description Usage Arguments Value See Also Examples

View source: R/gt_stretch.R

Description

Stretch geometric objects by a scale factor in x and y dimension.

Usage

1
gt_stretch(obj, x = NULL, y = NULL, fid = NULL, update = TRUE)

Arguments

obj

[geometric object(1)]
the object to stretch.

x

[numeric(1)]
the scale factor in x dimension.

y

[numeric(1)]
the scale factor in y dimension.

fid

[integerish(.)]
if only a subset of features shall be stretched, specify that here.

update

[logical(1)]
whether or not to update the window slot after stretching.

Value

geom of the stretched obj.

See Also

Other geometry tools: gt_filter(), gt_locate(), gt_pull(), gt_reflect(), gt_rotate(), gt_scale(), gt_skew(), gt_translate()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# stretch several features
visualise(gtGeoms$polygon, linewidth = 3)
newPoly <- gt_stretch(obj = gtGeoms$polygon, x = 0.5, y = 0.2,
                      update = FALSE)
visualise(geom = newPoly, linecol = "green", new = FALSE)

# stretch a single feature
visualise(gtGeoms$polygon, linewidth = 3)
newPoly <- gt_stretch(obj = gtGeoms$polygon, x = 0.5, fid = 2, update = FALSE)
visualise(geom = newPoly, linecol = "green", new = FALSE)

# stretch feature separately
visualise(gtGeoms$polygon, linewidth = 3)
newPoly <- gt_stretch(obj = gtGeoms$polygon,
                      x = c(0.2, 1),
                      y = c(1, 0.2),
                      update = FALSE)
visualise(geom = newPoly, linecol = "green", new = FALSE)

geometr documentation built on March 30, 2021, 5:13 p.m.