Skip to contents

has_intersection() is an S3 method that returns whether two objects intersect.

Usage

has_intersection(x, y, ...)

# Default S3 method
has_intersection(x, y, ...)

# S3 method for class 'Point1D'
has_intersection(x, y, ..., tolerance = sqrt(.Machine$double.eps))

# S3 method for class 'Line2D'
has_intersection(x, y, ..., tolerance = sqrt(.Machine$double.eps))

# S3 method for class 'Plane3D'
has_intersection(x, y, ..., tolerance = sqrt(.Machine$double.eps))

Arguments

x, y

The two objects to check if they intersect.

...

Passed to other methods (or ignored).

tolerance

Numerics with differences smaller than tolerance will be considered “equivalent”.

Value

A logical vector.

Details

affiner::has_intersection() has the same S3 signature and default method as euclid::has_intersection() (so it shouldn't matter if one masks the other).

Examples

line1 <- as_line2d("x-axis")
line2 <- as_line2d("y-axis")
line3 <- as_line2d(a = 0, b = 1, c = 2) # y + 2 = 0
has_intersection(line1, line1)
#> [1] TRUE
has_intersection(line1, line2)
#> [1] TRUE
has_intersection(line1, line3)
#> [1] FALSE