Currently works for all combinations of instances of
object-class.
Usage
intersects(object, other_object, ...)
# S4 method for class 'polygon,polygon'
intersects(object, other_object, cpp = TRUE)
# S4 method for class 'polygon,circle'
intersects(object, other_object, ...)
# S4 method for class 'polygon,segment'
intersects(object, other_object, ...)
# S4 method for class 'circle,polygon'
intersects(object, other_object, cpp = TRUE)
# S4 method for class 'circle,circle'
intersects(object, other_object, ...)
# S4 method for class 'circle,segment'
intersects(object, other_object, ...)
# S4 method for class 'segment,polygon'
intersects(object, other_object, cpp = TRUE)
# S4 method for class 'segment,circle'
intersects(object, other_object, cpp = TRUE)
# S4 method for class 'segment,segment'
intersects(object, other_object, ...)Arguments
- object
Object of
object-class.- other_object
Object of
object-classto check intersection with.- ...
Arguments passed on to methods of this generic
- cpp
Logical denoting whether to use the Rcpp alternative (
TRUE) or the R alternative of this function (FALSE). Defaults toTRUE.
Details
Note that this function is less efficient than the combination of
nodes_on_circumference and
in_object, which is why this combination is
used in overlap_with_objects instead of the
intersects method
Note that while rectangle-class is not explicitly
mentioned here, this method does work for this class of objects.
Examples
# Create two objects that intersect with each other, and check their
# intersection
my_circle <- circle(center = c(0, 0), radius = 1)
my_rectangle <- rectangle(center = c(0, 0), size = c(0.75, 0.75))
intersects(my_circle, my_rectangle)
#> [1] TRUE
# Create two objects that do not intersect with each other, and check their
# intersection
my_circle <- circle(center = c(0, 0), radius = 1)
my_rectangle <- rectangle(center = c(0, 0), size = c(1.25, 1.25))
intersects(my_circle, my_rectangle)
#> [1] TRUE