solve2lines | R Documentation |
Find the intersection point of two lines.
solve2lines(line1, line2, toplot = TRUE)
line1 |
A list containing two coordinate pairs defining the first line segment. Format: |
line2 |
A list containing two coordinate pairs defining the second line segment. Format: |
toplot |
If |
Developed for the function whalemap
to test whether a bearing line from a vessel to a whale sighting intersects the shoreline before the horizon.
In that scenario, line1
would be the bearing line between the vessel and the whale. line2
would be formed between two points in a shoreline polygon.
This function would be looped to test for intersection between all shoreline points. It does not mess with Great-Sphere distances.
A 2-element vector, the X and Y of the intersection point. If there is no solution (i.e., parallel lines), both elements are NA
.
Eric Keen, Scripps Institution of Oceanography, ekeen@ucsd.edu
whalemap
line1 <- list(c(-129,53),c(-129.5,53.2))
line2 <- list(c(-128.5,53.12),c(-129.15,53.62))
solve2lines(line1,line2,toplot=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.