Generalization of the intersects for segments,
allowing for vectorized checking of intersections with segments. Is often
used within the intersects, especially when
checking the intersections of polygon-class and
rectangle-class. Currently works for all instances
of object-class.
Usage
line_intersection(object, segments, ...)
# S4 method for class 'polygon'
line_intersection(object, segments, return_all = FALSE, cpp = TRUE)
# S4 method for class 'circle'
line_intersection(object, segments, return_all = FALSE, cpp = TRUE)
# S4 method for class 'segment'
line_intersection(object, segments, return_all = FALSE, cpp = TRUE)Arguments
- object
Object of a type that extends
object-class.- segments
Numerical matrix of size N x 4 containing the coordinates of the line segments in order x_1, y_1, x_2, y_2.
- ...
Arguments passed on to the methods of this generic
- return_all
Logical denoting whether to return a vector of logicals that denote intersections of each line separately (
TRUE) or whether to only return a single logical denoting whether any intersections occurred (FALSE). Defaults toFALSE.- cpp
Logical denoting whether to use the Rcpp (
TRUE) or R (FALSE) alternative of this function. Defaults toTRUE.
Value
Logical vector (return_all = TRUE) or logical
(return_all = FALSE) denoting whether the lines intersect with the
provided object. Whenever there is an intersection, the logical is TRUE
and otherwise, the logical is FALSE.
Details
Note that while rectangle-class is not explicitly
mentioned here, this method does work for this class of objects.