
Last chance! 50% off unlimited learning
Sale ends in
Finder intersection point of two vectors in a plane
Sect2vex(V1, V2)
vector of 2 points
vector of 2 points
x-y location of intersection
if vectors are parallel return NULL
AXB.prod
# NOT RUN {
v1 = matrix(runif(4), ncol=2)
v2 = matrix(runif(4), ncol=2)
pt = Sect2vex(v1, v2)
plot(c(v1[,1],v2[,1],pt[1] ) , c(v1[,2],v2[,2],pt[2]) , asp=1)
arrows(v1[1,1], v1[1,2], v1[2,1], v1[2,2])
arrows(v2[1,1], v2[1,2], v2[2,1], v2[2,2])
points(pt[1], pt[2], col='red', cex=2, pch=3)
# }
Run the code above in your browser using DataLab