width: SpatVector geometric properties

widthR Documentation

SpatVector geometric properties

Description

width returns the minimum diameter of the geometry, defined as the smallest band that contains the geometry, where a band is a strip of the plane defined by two parallel lines. This can be thought of as the smallest hole that the geometry can be moved through, with a single rotation.

clearance returns the minimum clearance of a geometry. The minimum clearance is the smallest amount by which a vertex could be moved to produce an invalid polygon, a non-simple linestring, or a multipoint with repeated points. If a geometry has a minimum clearance of 'mc', it can be said that:

No two distinct vertices in the geometry are separated by less than 'mc' No vertex is closer than 'mc' to a line segment of which it is not an endpoint. If the minimum clearance cannot be defined for a geometry (such as with a single point, or a multipoint whose points are identical, NA is returned.

Usage

## S4 method for signature 'SpatVector'
width(x, as.lines=FALSE)
## S4 method for signature 'SpatVector'
clearance(x, as.lines=FALSE)

Arguments

x

SpatVector of lines or polygons

as.lines

logical. If TRUE lines are returned that define the width or clearance

Value

numeric or SpatVector

See Also

minRect

Examples

f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
width(v)
clearance(v)

terra documentation built on Oct. 14, 2024, 5:07 p.m.