funsAB2MTe {pcds} | R Documentation |
The lines joining the three vertices of
the standard equilateral triangle to a center, M
, of it
Description
Three functions, lineA2MinTe
, lineB2MinTe
and lineC2MinTe
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
.
lineA2MinTe
is the line joining A
to the center, M
,
lineB2MinTe
is the line joining B
to M
,
and lineC2MinTe
is the line joining C to M
,
in the standard equilateral triangle T_e=(A,B,C)
with A=(0,0)
, B=(1,0)
, C=(1/2,\sqrt{3}/2)
;
x
-coordinates are provided in vector
x
Usage
lineA2MinTe(x, M)
lineB2MinTe(x, M)
lineC2MinTe(x, M)
Arguments
x |
A single scalar or a |
M |
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. |
Value
A list
with the elements
txt1 |
Longer description of the line. |
txt2 |
Shorter description of the line (to be inserted over the line in the plot). |
mtitle |
The |
cent |
The center chosen inside the standard equilateral triangle. |
cent.name |
The name of the center inside the standard equilateral triangle. |
tri |
The triangle (it is the standard equilateral triangle for this function). |
x |
The input vector, can be a scalar
or a |
y |
The output vector,
will be a scalar if |
slope |
Slope of the line. |
intercept |
Intercept of the line. |
equation |
Equation of the line. |
See Also
Examples
#Examples for lineA2MinTe
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<-lineA2MinTe(x,M)
lnAM
summary(lnAM)
plot(lnAM)
Ds<-prj.cent2edges(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,lineA2MinTe(.25,M)$y),c(.4,lineB2MinTe(.4,M)$y),
c(.60,lineC2MinTe(.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","lineA2MinTe(x)","lineB2MinTe(x)","lineC2MinTe(x)")
text(xc,yc,txt.str)
lineA2MinTe(.25,M)
#Examples for lineB2MinTe
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 = .5) #try also by = .1
lnBM<-lineB2MinTe(x,M)
lnBM
summary(lnBM)
plot(lnBM)
#Examples for lineC2MinTe
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 = .5)
#try also by = .1
lnCM<-lineC2MinTe(x,M)
lnCM
summary(lnCM)
plot(lnCM)