These predicate functions checks for whether a geometry varies along a given axis. While it is common in 2 dimensions to ask whether something is vertical or horizontal that notion does not scale well to 3 dimensions and euclid instead elects to check for whether a given geometry is constant in a specific coordinate value. As such, e.g. has_constant_x() is equivalent to asking whether a given 2 dimensional geometry is vertical but also works for 3 dimensional geometries.

is_constant_in(x, axis)

has_constant_x(x)

has_constant_y(x)

has_constant_z(x)

Arguments

x

A geometry vector

axis

One or more specifications of the axes to check against as "x", "y", "z" or 1, 2, 3

Value

A logical vector

Examples

# Check for horizontal vector v <- vec(1, -2:2) has_constant_y(v)
#> [1] FALSE FALSE TRUE FALSE FALSE
# Use recycling to check all axes is_constant_in(vec(2, 0, -5), c("x", "y", "z"))
#> [1] FALSE TRUE FALSE