M
, of itThree functions, lA_M.Te
, lB_M.Te
and lC_M.Te
of class "TriLines".
Returns the equation, slope, intercept
, and y-coordinates of the lines joining A and M
,
B and M
, and also C and M
.
lA_M.Te
is the line joining A to the center, M
, lB_M.Te
is the line joining B to M
,
and lC_M.Te
is the line joining C to M
, in the standard equilateral triangle x
lA_M.Te(x, M)lB_M.Te(x, M)
lC_M.Te(x, M)
A single scalar or a vector of scalars.
A 2D point in Cartesian coordinates or a 3D point in barycentric coordinates which serves as a center in the interior of the standard equilateral triangle.
A list with the elements
Longer description of the line.
Shorter description of the line (to be inserted over the line in the plot).
The "main" title for the plot of the line.
The center chosen inside the standard equilateral triangle.
The name of the center inside the standard equilateral triangle.
The triangle (it is the standard equilateral triangle for this function).
The input vector, can be a scalar or a vector of scalars, which constitute the x-coordinates of the point(s) of interest on the line.
The output vector, will be a scalar if x
is a scalar or a vector of scalars if x
is
a vector of scalar, constitutes the y-coordinates of the point(s) of interest on the line.
Slope of the line.
Intercept of the line.
Equation of the line.
# NOT RUN {
#Examples for lA_M.Te
# }
# NOT RUN {
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-rbind(A,B,C)
M<-c(.65,.2) #try also M<-c(1,1,1)
xfence<-abs(A[1]-B[1])*.25 #how far to go at the lower and upper ends in the x-coordinate
x<-seq(min(A[1],B[1])-xfence,max(A[1],B[1])+xfence,by=.1) #try also by=.01
lnAM<-lA_M.Te(x,M)
lnAM
summary(lnAM)
plot(lnAM)
Ds<-cp2e.tri(Te,M)
#finds the projections from a point M=(m1,m2) to the edges on the
#extension of the lines joining M to the vertices in the triangle Te
Xlim<-range(Te[,1])
Ylim<-range(Te[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(Te,pch=".",xlab="",ylab="",
xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Te)
L<-Te; R<-rbind(M,M,M)
segments(L[,1], L[,2], R[,1], R[,2], lty=2)
L<-Ds; R<-rbind(M,M,M)
segments(L[,1], L[,2], R[,1], R[,2], lty=3,col=2)
txt<-rbind(Te,M,Ds,c(.25,lA_M.Te(.25,M)$y),c(.4,lB_M.Te(.4,M)$y),
c(.60,lC_M.Te(.60,M)$y))
xc<-txt[,1]+c(-.02,.02,.02,.02,.04,-.03,.0,0,0,0)
yc<-txt[,2]+c(.02,.02,.02,.05,.02,.03,-.03,0,0,0)
txt.str<-c("A","B","C","M","D1","D2","D3","lA_M.Te(x)","lB_M.Te(x)","lC_M.Te(x)")
text(xc,yc,txt.str)
lA_M.Te(.25,M)
# }
# NOT RUN {
#Examples for lB_M.Te
# }
# NOT RUN {
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-rbind(A,B,C)
M<-c(.65,.2) #try also M<-c(1,1,1)
xfence<-abs(A[1]-B[1])*.25 #how far to go at the lower and upper ends in the x-coordinate
x<-seq(min(A[1],B[1])-xfence,max(A[1],B[1])+xfence,by=.1) #try also by=.01
lnBM<-lB_M.Te(x,M)
lnBM
summary(lnBM)
plot(lnBM)
lB_M.Te(.25,M)
# }
# NOT RUN {
#Examples for lC_M.Te
# }
# NOT RUN {
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-rbind(A,B,C)
M<-c(.65,.2) #try also M<-c(1,1,1)
xfence<-abs(A[1]-B[1])*.25 #how far to go at the lower and upper ends in the x-coordinate
x<-seq(min(A[1],B[1])-xfence,max(A[1],B[1])+xfence,by=.1) #try also by=.01
lnCM<-lC_M.Te(x,M)
lnCM
summary(lnCM)
plot(lnCM)
lC_M.Te(.25,M)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab