Learn R Programming

pcds (version 0.1.4)

paraline3D: 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)

Value

A list with the elements

desc

A description of the line

mtitle

The "main" title for the plot of the line

points

The input points that determine the line to which the line crossing point P would be parallel.

pnames

The names of the input points that determine the line to which the line crossing point P would be parallel.

vecs

The points P, A, and B stacked row-wise in this order.

vec.names

The names of the points P, A, and B.

x,y,z

The \(x\)-, \(y\)-, and \(z\)-coordinates of the point(s) of interest on the line parallel to the line determined by points A and B.

tsq

The scalar or the vector of the parameter in defining each coordinate of the line for the form: \(x=x_0 + a t\), \(y=y_0 + b t\), and \(z=z_0 + c t\) where \(P=(x_0,y_0,z_0)\) and \(B-A=(a,b,c)\).

equation

Equation of the line passing through point P and parallel to the line joining points A and B (i.e., in the direction of the vector B-A). The line equation is in the form: \(x=x_0 + a t\), \(y=y_0 + b t\), and \(z=z_0 + c t\) where \(P=(x_0,y_0,z_0)\) and \(B-A=(a,b,c)\).

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 P would be parallel (i.e., \(B-A\) determines the direction of the straight line passing through P).

t

A scalar or a vector of scalars representing the parameter of the coordinates of the line (for the form: \(x=x_0 + a t\), \(y=y_0 + b t\), and \(z=z_0 + c t\) where \(P=(x_0,y_0,z_0)\) and \(B-A=(a,b,c)\)).

Author

Elvan Ceyhan

See Also

Line3D, perp.ln2pl, and paraline

Examples

Run this code
# \donttest{
P<-c(1,10,4); A<-c(1,1,3); B<-c(3,9,12)

vecs<-rbind(P,B-A)
pts<-rbind(P,A,B)
paraline3D(P,A,B,.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=20)  #try also l=100

pln3D<-paraline3D(P,A,B,tsq)
pln3D
summary(pln3D)
plot(pln3D)

paraline3D(P,A,B,c(.1,.2))

x<-pln3D$x
y<-pln3D$y
z<-pln3D$z

zr<-range(z)
zf<-(zr[2]-zr[1])*.2
Av<-(B-A)*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)*(B-A)

plot3D::lines3D(x, y, z, phi = 0, bty = "g",
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]+Av[1],Dr[2]+Av[2],Dr[3]+zf+Av[3], add=TRUE)
plot3D::points3D(pts[,1],pts[,2],pts[,3],add=TRUE)
plot3D::text3D(pts[,1],pts[,2],pts[,3],labels=c("P","A","B"),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]+Av[1]/2,Dr[2]+Av[2]/2,Dr[3]+3*zf+Av[3]/2,Dr[1]+Av[1]/2,
Dr[2]+Av[2]/2,Dr[3]+zf+Av[3]/2,lty=2, add=TRUE)
plot3D::text3D(Dr[1]+Av[1]/2,Dr[2]+Av[2]/2,Dr[3]+3*zf+Av[3]/2,labels="direction vector",add=TRUE)
plot3D::text3D(Dr[1]+Av[1]/2,Dr[2]+Av[2]/2,Dr[3]+zf+Av[3]/2,labels="B-A",add=TRUE)
# }

Run the code above in your browser using DataLab