`R/geometry_predicates.R`

`geometry_turns.Rd`

In 2D the bend three consecutive points form can be oriented either to the
left or two the right. Asking whether it takes a left turn is equivalent to
asking whether `z`

lies on the positive side of the supporting line of
`x`

->`y`

. euclid provides two predicate functions to check whether left or
right turns are constructed from three given point vectors (note that
collinear points will be `FALSE`

for both predicates). It also provides a
function that calculate turn orientation along a single vector of points. The
result of this are given as: `1`

(left), `0`

(collinear), or `-1`

(right).
Note that the output of `turn_along()`

is two elements shorter than the
input.

turns_left(x, y, z) turns_right(x, y, z) turn_along(x)

x, y, z | Vectors of 2D points |
---|

Either a logical vector or an integer vector (for `turn_along()`

)

#> [1] TRUE FALSE TRUE TRUEturn_along(p)#> [1] -1 -1 1 -1 -1 -1 1 1 1 -1