Learn R Programming

geometr (version 0.2.5)

gt_skew: Skew geoms

Description

Skew geoms by a shear factor in x and y-dimension.

Usage

gt_skew(geom, x = NULL, y = NULL, fid = NULL, update = TRUE)

Arguments

geom

[geom(.)] the object to skew.

x

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

y

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

fid

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

update

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

Value

Skewed geom.

See Also

Other geometry tools: gt_reflect(), gt_rotate(), gt_scale(), gt_sketch(), gt_stretch(), gt_translate()

Examples

Run this code
# NOT RUN {
# the original object
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 <- gs_polygon(anchor = coords, window = window)

# skew several geoms
visualise(geom = gt_skew(geom = aGeom, x = list(0.5), y = list(0, 0.2)))

# skew single geom
visualise(geom = gt_skew(geom = aGeom, x = 0.5, fid = 1))
# }

Run the code above in your browser using DataLab