Description Usage Arguments Details Value Author(s) Examples

View source: R/circles.intersect.R

`circles.intersect`

determines whether circles
intersect with each other.

1 | ```
circles.intersect(coords, r)
``` |

`coords` |
A matrix of coordinates with the centroid of each circle. |

`r` |
A vector containing the radii of the circles.
The length of |

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.

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

Joshua French

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
# first two circles intersect each other,
# the next two circles intersect each other
# (but not the previous ones)
# the last circles doesn't intersect any other circle
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)
# draw circles
circles.plot(co, r)
# confirm intersections
circles.intersect(co, r)
# nested circles (don't intersect)
co = matrix(rep(0, 4), nrow = 2)
r = c(1, 1.5)
circles.plot(co, r)
circles.intersect(co, r)
``` |

smacpod documentation built on Jan. 26, 2018, 1 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.