Description Usage Arguments Value Author(s) Source Examples
Determine the intersection of two lines L1 and L2 in two dimensions, using the formula described by Weisstein.
1 | line.line.intersection(P1, P2, P3, P4, interior.only = FALSE)
|
P1 |
vector containing x,y coordinates of one end of L1 |
P2 |
vector containing x,y coordinates of other end of L1 |
P3 |
vector containing x,y coordinates of one end of L2 |
P4 |
vector containing x,y coordinates of other end of L2 |
interior.only |
boolean flag indicating whether only intersections inside L1 and L2 should be returned. |
Vector containing x,y coordinates of intersection of L1
and L2. If L1 and L2 are parallel, this is infinite-valued. If
interior.only
is TRUE
, then when the intersection
does not occur between P1 and P2 and P3 and P4, a vector
containing NA
s is returned.
David Sterratt
Weisstein, Eric W. "Line-Line Intersection." From MathWorld–A Wolfram Web Resource. http://mathworld.wolfram.com/Line-LineIntersection.html
1 2 3 4 5 | ## Intersection of two intersecting lines
line.line.intersection(c(0, 0), c(1, 1), c(0, 1), c(1, 0))
## Two lines that don't intersect
line.line.intersection(c(0, 0), c(0, 1), c(1, 0), c(1, 1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.