View source: R/geom_p2pIntersect.R
p2p.multiLine | R Documentation |
Compute lines of intersection between multiple planes, one pair at a time. This uses the p2p.line function on all combinations of input planes.
p2p.multiLine(c.m)
c.m |
Matrix of coefficients for the plane equations, one per row. |
A dataframe containing the line equation coefficients (vector form, one per row) as well as the IDs of the planes whose intersection a given line represents.
Write unit tests.
Cornel M. Pop
# A multiline intersection case
c.m = rbind(c(1, -3, 2, 7), c(4, 1, -1, 5), c(6, -5, 3, -1))
res = Lithics3D:::p2p.multiLine(c.m)
## Not run:
p1 = res[,1:3] # First point defining the intersection lines
p2 = res[,1:3] - res[,4:6]*0.1 # Second point defining the intersection line
library(rgl)
points3d(rbind(c(-10,-10,-10), c(10,10,10)))
lines3d(rbind(p1[1,], p2[1,]), lwd=5, col="red") # Draw the 1st intersection
lines3d(rbind(p1[2,], p2[2,]), lwd=5, col="blue") # Draw the 2nd intersection
lines3d(rbind(p1[3,], p2[3,]), lwd=5, col="yellow") # Draw the 3rd intersection
planes3d(c.m[,1], c.m[,2], c.m[,3], c.m[,4], col="green") # Render the intersecting planes
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.