p2p.line: Line of intersection between two planes

View source: R/geom_p2pIntersect.R

p2p.lineR Documentation

Line of intersection between two planes

Description

Compute line of intersection between two non-parallel planes

Usage

p2p.line(p1c, p2c)

Arguments

p1c

Coefficients for the first plane equation

p2c

Coefficients for the second plane equation

Value

A dataframe with the line equation coefficients (vector form)

TODO

Test function to make sure it operates fine.

Note

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

Author(s)

Cornel M. Pop

Examples

# 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)

cornelmpop/Lithics3D documentation built on Feb. 10, 2024, 11:54 p.m.