Line3D {pcds} | R Documentation |
The line crossing 3D point p
in the direction of vector
v
(or if v
is a point,
in direction of v-r_0
)
Description
An object of class "Lines3D"
.
Returns the equation, x
-, y
-,
and z
-coordinates of the line crossing 3D point r_0
in the direction of vector
v
(of if v
is a point, in the direction of v-r_0
)
with the parameter t
being provided in vector
t
.
Usage
Line3D(p, v, t, dir.vec = TRUE)
Arguments
p |
A 3D point through which the straight line passes. |
v |
A 3D |
t |
A scalar or a |
dir.vec |
A logical argument about |
Value
A list
with the elements
desc |
A description of the line |
mtitle |
The |
pts |
The input points that determine a line and/or a plane,
|
pnames |
The names of the input points
that determine a line and/or a plane,
|
vecs |
The point |
vec.names |
The names of the point |
x , y , z |
The |
tsq |
The scalar or the |
equation |
Equation of the line passing through point |
Author(s)
Elvan Ceyhan
See Also
line
, paraline3D
,
and Plane
Examples
A<-c(1,10,3); B<-c(1,1,3);
vecs<-rbind(A,B)
Line3D(A,B,.1)
Line3D(A,B,.1,dir.vec=FALSE)
tr<-range(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
lnAB3D<-Line3D(A,B,tsq)
#try also lnAB3D<-Line3D(A,B,tsq,dir.vec=FALSE)
lnAB3D
summary(lnAB3D)
plot(lnAB3D)
x<-lnAB3D$x
y<-lnAB3D$y
z<-lnAB3D$z
zr<-range(z)
zf<-(zr[2]-zr[1])*.2
Bv<-B*tf*5
Xlim<-range(x)
Ylim<-range(y)
Zlim<-range(z)
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
zd<-Zlim[2]-Zlim[1]
Dr<-A+min(tsq)*B
plot3D::lines3D(x, y, z, phi = 0, bty = "g",
main="Line Crossing A \n in the Direction of OB",
xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05),
zlim=Zlim+zd*c(-.1,.1),
pch = 20, cex = 2, ticktype = "detailed")
plot3D::arrows3D(Dr[1],Dr[2],Dr[3]+zf,Dr[1]+Bv[1],
Dr[2]+Bv[2],Dr[3]+zf+Bv[3], add=TRUE)
plot3D::points3D(A[1],A[2],A[3],add=TRUE)
plot3D::arrows3D(A[1],A[2],A[3]-2*zf,A[1],A[2],A[3],lty=2, add=TRUE)
plot3D::text3D(A[1],A[2],A[3]-2*zf,labels="initial point",add=TRUE)
plot3D::text3D(A[1],A[2],A[3]+zf/2,labels=expression(r[0]),add=TRUE)
plot3D::arrows3D(Dr[1]+Bv[1]/2,Dr[2]+Bv[2]/2,Dr[3]+3*zf+Bv[3]/2,
Dr[1]+Bv[1]/2,Dr[2]+Bv[2]/2,Dr[3]+zf+Bv[3]/2,lty=2, add=TRUE)
plot3D::text3D(Dr[1]+Bv[1]/2,Dr[2]+Bv[2]/2,Dr[3]+3*zf+Bv[3]/2,
labels="direction vector",add=TRUE)
plot3D::text3D(Dr[1]+Bv[1]/2,Dr[2]+Bv[2]/2,
Dr[3]+zf+Bv[3]/2,labels="v",add=TRUE)
plot3D::text3D(0,0,0,labels="O",add=TRUE)