proj_pt2p | R Documentation |
Orthogonally projects a set of coordinates onto a 3D plane, defined by 3 co-planar points, and computes signed distances to the plane (i.e. if a point is above the plane, the sign will be negative). If only plane equation coefficients are available, use the pc2pt function to obtain co-planar points.
proj_pt2p(coords, p)
coords |
An Nx3 matrix-like object with point coordinates, one per row. |
p |
A 3x3 matrix-like object with coordinates defining a plane, one per row. |
An Nx4 data.frame object containing projected coordinates (columns 1-3) and signed distances (column 4) for every input point (one per row).
The Morpho::points2plane()
function of the Morpho package
provides similar, but not identical, functionality.
pts = data.frame(x=c(10, -10), y=c(33, -31) ,z=c(11, -7))
p = data.frame(x=c(1, 3, 4), y=c(0,2,1), z=c(3,4,5))
pts.proj = proj_pt2p(pts, p)
## Not run:
library(rgl)
points3d(pts, color="red")
p.coefs = planeCoefs(p)
planes3d(p.coefs[1], p.coefs[2], p.coefs[3], p.coefs[4])
points3d(pts.proj[,1:3], color="green", size=5)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.