Check whether points are collinear and ordered along the line
Source:R/geometry_predicates.R
in_order.Rd
If points are collinear it is possible to ask whether they are ordered along the common line. This function is not strict, i.e. it is possible for the middle point to coincide with either the first or last point and still be regarded as ordered between them. This functionality comes in two versions, one that access orderedness between three vectors of points and one that assess it along a single vector. Note that for the later version the return value is 2 elements shorter than the input vector.
See also
Other Predicates:
collinear()
,
constant_in
,
geometry_class
,
geometry_turns
,
has_intersection()
,
is_degenerate()
,
location_predicates
,
parallel()
Examples
p <- point(1:30, 1:30)
p <- p[sample(30)]
in_order(p[1:10], p[11:20], p[21:30])
#> [1] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE
in_order_along(p)
#> [1] TRUE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE TRUE FALSE
#> [13] FALSE TRUE FALSE TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE
#> [25] FALSE FALSE FALSE TRUE