View source: R/geom_p2pIntersect.R
p2p.line | R Documentation |
Compute line of intersection between two non-parallel planes
p2p.line(p1c, p2c)
p1c |
Coefficients for the first plane equation |
p2c |
Coefficients for the second plane equation |
A dataframe with the line equation coefficients (vector form)
Test function to make sure it operates fine.
This works by finding a common point with a third plane whose normal is the intersection line, and using the p2p.point solver to get its coordinates. For testing, see applet at: http://www.songho.ca/math/plane/plane.html#example_2planes
Cornel M. Pop
# A lineintersection case
c.m = rbind(c(-7, 1, -2, 3), c(7, -2, 3, -4), c(-5, 3, -6, 10))
res = Lithics3D:::p2p.line(c.m[1,], c.m[2,]) # Use first two planes
## Not run:
# First point defining the intersection line
p1 = unlist(res[,1:3])
# Second point defining the intersection line
p2 = unlist(res[,1:3] - res[,4:6]*0.1)
library(rgl)
points3d(rbind(c(-5,-5,-5), c(5,5,5)))
lines3d(rbind(p1, p2), lwd=5, col="red") # Draw the line
# Render the intersecting planes
planes3d(c.m[,1], c.m[,2], c.m[,3], c.m[,4], col="green")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.