circles.intersect: Determine whether circles intersection

Description Usage Arguments Details Value Author(s) Examples

Description

circles.intersect determines whether circles intersect with each other.

Usage

1
circles.intersect(coords, r)

Arguments

coords

A matrix of coordinates containined the centroid of each circle.

r

A vector containing the radii of the circles. The have length equal to the number of rows of coords.

Details

The algorithm is based on the premise that two circles intersect if, and only if, the distance between their centroids is between the sum and the difference of their radii. I have squared the respective parts of the inequality in the implemented algorithm.

Value

Returns a matrix of logical values indicating whether the circles intersect.

Author(s)

Joshua French

Examples

1
2
3
4
5
6
7
8
# first two intersect, then next two, last doesn't intersect any other
co = cbind(c(1, 2, 5, 6, 9), c(1, 2, 5, 6, 9))
r = c(1.25, 1.25, 1.25, 1.25, 1.25)
circles.intersect(co, r)
# nested circles
co = matrix(rep(0, 4), nrow = 2)
r = c(1, 1.5)
circles.intersect(co, r)


Search within the smacpod package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.