TRUE when the geometry's ring turns consistently in one direction. A
polygon is judged on its exterior ring.
Details
A linestring must be closed, that is form a ring, to be reported convex; an
open one is FALSE. A polygon's exterior ring is always closed, so polygons
need no special handling. Any other geometry type, or a null geometry,
becomes NA rather than FALSE.
See also
Other query:
ga_closest_point(),
ga_interior_point(),
ga_line_locate_point()
Examples
square <- sf::st_polygon(list(
matrix(c(0, 0, 1, 0, 1, 1, 0, 1, 0, 0), ncol = 2, byrow = TRUE)
))
g <- geoarrow::as_geoarrow_array(sf::st_sfc(square))
as.vector(ga_is_convex(g))
#> [1] TRUE