Skip to contents

Shears each geometry by degrees along both the x and y dimensions, about the geometry's own centroid. The geometry type of the output matches the geometry type of the input.

Usage

ga_skew(geometry, degrees)

Arguments

geometry

a GeoArrow point, linestring, multilinestring, polygon, or multipolygon array

degrees

the shear angle; length 1 or the same length as geometry

Value

a GeoArrow array of the same geometry type as the input

References

Skew

Examples

sq <- geoarrow::as_geoarrow_array(sf::st_sfc(
  sf::st_polygon(list(rbind(c(0, 0), c(2, 0), c(2, 2), c(0, 2), c(0, 0))))
))

# a shear leaves the area unchanged
geoarrow::as_geoarrow_vctr(ga_skew(sq, 30))
#> <geoarrow_vctr geoarrow.polygon{list}[1]>
#> [1] <POLYGON ((-0.5773503 -0.5773503, 1.4226497 0.5773503, 2.5773503 2.5773>
as.vector(ga_unsigned_area(ga_skew(sq, 30)))
#> [1] 2.666667