Determines if a point is on or left of the vector described by two other points.
on.RdA simple test function to determine the position of one (or more) points relative to a vector spanned by two points.
Arguments
- x1
xcoordinate of first point determinig the vector.- y1
ycoordinate of first point determinig the vector.- x2
xcoordinate of second point determinig the vector.- y2
ycoordinate of second point determinig the vector.- x0
vector of
xcoordinates to locate relative to the vector \((x_2-x_1, y_2-y_1)\).- y0
vector of
xcoordinates to locate relative to the vector \((x_2-x_1, y_2-y_1)\).- eps
tolerance for checking if \(x_0,y_0\) is on or left of \((x_2-x_1, y_2-y_1)\), defaults to \(10^{-16}\).
Author
Albrecht Gebhardt <[email protected]>, Roger Bivand <[email protected]>
Examples
y <- x <- c(0,1)
## should be TRUE
on(x[1],y[1],x[2],y[2],0.5,0.5)
#> [1] TRUE
## note the default setting of eps leading to
on(x[1],y[1],x[2],y[2],0.5,0.50000000000000001)
#> [1] TRUE
## also be TRUE
## should be TRUE
left(x[1],y[1],x[2],y[2],0.5,0.6)
#> [1] TRUE
## note the default setting of eps leading to
left(x[1],y[1],x[2],y[2],0.5,0.50000000000000001)
#> [1] FALSE
## already resulting to FALSE