The cross track distance (or cross track error) is the distance of a point from a great-circle path. The great circle path is defined by p1 and p2, while p3 is the point away from the path.
Usage
crossTrackDistance(p1, p2, p3, r=6378137)
Arguments
p1
Start of great circle path. longitude/latitude of point(s). Can be a vector of two numbers, a matrix of 2 columns (first one is longitude, second is latitude) or a SpatialPoints* object
p2
End of great circle path. As above
p3
Point away from the great cricle path. As for p2
r
radius of the earth; default = 6378137
Value
A distance in units of r (default is meters)
The sign indicates which side of the path p3 is on. Positive means right of the course from p1 to p2, negative means left.