pc2pt | R Documentation |
Given plane equation coefficients this function returns a set of 3 points that lie on the plane. The points will be located close to the point on the plane that is closest to the origin, but for all practical purposes they can be considered to be arbitrary points.
Note that the signs of the individual coefficients may be inverted (either all or none), but the result is the same
pc2pt(p.coefs)
p.coefs |
A vector of length 4 giving plane equation coefficients a, b, c, d describing a plane as ax + by + cz + d = 0. |
A 3x3 matrix containing points (one per row) located on the plane. Note that the first point is the point closest to the origin.
Based on answer given by ja72 on https://math.stackexchange.com/questions/1755856/calculate-arbitrary-points-from-a-plane-equation
Cornel M. Pop
library(rgl)
p = data.frame(x=c(1, 3, 4), y=c(0,2,1), z=c(3,4,5))
p.coefs = planeCoefs(p)
p2 = pc2pt(p.coefs)
p2.coefs = planeCoefs(p2)
points3d(p2, color="red")
points3d(p, color="green")
planes3d(p.coefs[1], p.coefs[2], p.coefs[3], p.coefs[4], color="blue",
alpha=0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.