paraline3D {pcds} | R Documentation |
The line crossing the 3D point p
and parallel to line joining 3D points a
and b
Description
An object of class "Lines3D"
.
Returns the equation, x
-, y
-,
and z
-coordinates of the line crossing 3D point p
and parallel to the line
joining 3D points a
and b
(i.e., the line is in the direction of vector
b
-a
)
with the parameter t
being provided in vector
t
.
Usage
paraline3D(p, a, b, t)
Arguments
p |
A 3D point through which the straight line passes. |
a , b |
3D points
which determine the straight line to which
the line passing through point |
t |
A scalar or a |
Value
A list
with the elements
desc |
A description of the line |
mtitle |
The |
points |
The input points
that determine the line to which the line
crossing point |
pnames |
The names of the input points
that determine the line to which the line crossing point |
vecs |
The points |
vec.names |
The names of the points |
x , y , z |
The |
tsq |
The scalar or the |
equation |
Equation of the line
passing through point |
Author(s)
Elvan Ceyhan
See Also
Line3D
, perpline2plane
,
and paraline
Examples
P<-c(1,10,4); Q<-c(1,1,3); R<-c(3,9,12)
vecs<-rbind(P,R-Q)
pts<-rbind(P,Q,R)
paraline3D(P,Q,R,.1)
tr<-range(pts,vecs);
tf<-(tr[2]-tr[1])*.1
#how far to go at the lower and upper ends in the x-coordinate
tsq<-seq(-tf*10-tf,tf*10+tf,l=5) #try also l=10, 20, or 100
pln3D<-paraline3D(P,Q,R,tsq)
pln3D
summary(pln3D)
plot(pln3D)
x<-pln3D$x
y<-pln3D$y
z<-pln3D$z
zr<-range(z)
zf<-(zr[2]-zr[1])*.2
Qv<-(R-Q)*tf*5
Xlim<-range(x,pts[,1])
Ylim<-range(y,pts[,2])
Zlim<-range(z,pts[,3])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
zd<-Zlim[2]-Zlim[1]
Dr<-P+min(tsq)*(R-Q)
plot3D::lines3D(x, y, z, phi = 0, bty = "g",
main="Line Crossing P \n in the direction of R-Q",
xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05),
zlim=Zlim+zd*c(-.1,.1)+c(-zf,zf),
pch = 20, cex = 2, ticktype = "detailed")
plot3D::arrows3D(Dr[1],Dr[2],Dr[3]+zf,Dr[1]+Qv[1],
Dr[2]+Qv[2],Dr[3]+zf+Qv[3], add=TRUE)
plot3D::points3D(pts[,1],pts[,2],pts[,3],add=TRUE)
plot3D::text3D(pts[,1],pts[,2],pts[,3],labels=c("P","Q","R"),add=TRUE)
plot3D::arrows3D(P[1],P[2],P[3]-2*zf,P[1],P[2],P[3],lty=2, add=TRUE)
plot3D::text3D(P[1],P[2],P[3]-2*zf,labels="initial point",add=TRUE)
plot3D::arrows3D(Dr[1]+Qv[1]/2,Dr[2]+Qv[2]/2,
Dr[3]+3*zf+Qv[3]/2,Dr[1]+Qv[1]/2,
Dr[2]+Qv[2]/2,Dr[3]+zf+Qv[3]/2,lty=2, add=TRUE)
plot3D::text3D(Dr[1]+Qv[1]/2,Dr[2]+Qv[2]/2,Dr[3]+3*zf+Qv[3]/2,
labels="direction vector",add=TRUE)
plot3D::text3D(Dr[1]+Qv[1]/2,Dr[2]+Qv[2]/2,
Dr[3]+zf+Qv[3]/2,labels="R-Q",add=TRUE)