Learn R Programming

affiner (version 0.2.1)

has_intersection: Whether two objects intersect

Description

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

Usage

has_intersection(x, y, ...)

# S3 method for default has_intersection(x, y, ...)

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

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

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

Value

A logical vector.

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”.

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

Run this code
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)
has_intersection(line1, line2)
has_intersection(line1, line3)

Run the code above in your browser using DataLab