pointDistance2 performs Pythagorean Theorem and cbinds all columns from to to new dists column. It is only defined for one point (from) to many (to) points. pointDistance3 performs Pythagorean Theorem and is to be used internally within distanceFromEachPoint as an alternative to .pointDistance, where it does many points (from) to many (to) points, one from point at a time. The results are then rbinded internally. It does not cbind extra columns from to.

pointDistance2(to, from)

pointDistance3(fromX, toX, fromY, toY, maxDistance)

.pointDistance(
from,
to,
angles = NA,
maxDistance = NA_real_,
otherFromCols = FALSE
)

## Arguments

to Numeric matrix with 2 or 3 columns (or optionally more, all of which will be returned), x and y, representing x and y coordinates of "to" cells, and optional "id" which will be matched with "id" from from. Default is all cells. Numeric matrix with 2 or 3 or more columns. They must include x and y, representing x and y coordinates of "from" cell. If there is a column named "id", it will be "id" from to, i.e,. specific pair distances. All other columns will be included in the return value of the function. Numeric vector of x coordinates for 'from' points Numeric vector of x coordinates for 'to' points Numeric vector of y coordinates for 'from' points Numeric vector of y coordinates for 'to' points Numeric scalar. The maximum distance cutoff for returned distances. Logical. If TRUE, then the function will return angles in radians, as well as distances. TODO: description needed

## Value

pointDistance2: a matrix with all the to columns plus one extra dists column. pointDistance3: a matrix with x and y columns from to plus one extra dists column.

A matrix with 3 columns, x0, y0 and dists.

## Details

A slightly faster way to calculate distances.