coords_onseg | R Documentation |
coords_onseg(coords, seg, tol = 0)
coords |
A Nx3 matrix-like object with x, y, and z point coordinates, one per row. |
seg |
A 2x3 matrix-like object containing x, y, and z coordinates for two points that define the line segment. |
tol |
(optional) Tolerance value for distance from the line segment; useful to deal with floating point precision errors. Default is 0. |
Determines if the given input coordinates lie on a line segment or not.
A Boolean vector indicating, for each input coordinate, whether they lie on the given line segment
Cornel M. Pop
proj_pt2l()
for projecting coordinates orthogonally onto a line.
coords = data.frame(x = c(14.830469, 12.812613),
y = c(-84.840050, -79.966871),
z = c(2.938235, 2.302472))
seg = data.frame(x = c(12.84073, 12.49499), y = c(-80.03477, -79.19981),
z = c(2.311330, 2.202399))
coords_onseg(coords, seg) # False, False
coords_onseg(coords, seg, tol = 0.001) # False, True
## Not run:
library(rgl)
points3d(coords, color = "red")
lines3d(seg), color = "blue")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.