Topic: Utilities

Topic Description:

Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.



File: utilities/geometry.r

View File Source Download File No help file available

Function: line.intersection.pts

Function Description: line.intersection.pts

Finds the point where 2 lines intersect, given each line as 2 pairs of points on the line

Function Arguments:

ArgumentDefault Value
pts1
pts2

Arguments Description:

Both arguments must have columns x, y, with two rows, one row per point.


Function Source:

line.intersection.pts=function(pts1,pts2)
{
line1=pts.to.interceptslope(pts1[1,],pts1[2,])
line2=pts.to.interceptslope(pts2[1,],pts2[2,])

return(line.intersection(m1=line1[1],b1=line1[2],m2=line2[1],b2=line2[2]))
}