Learn R Programming

pcds (version 0.1.4)

funsTbMid2CC: Two functions lD1CCinTb and lD2CCinTb which are of class "TriLines" ---

The lines joining the midpoints of edges to the circumcenter (eqnCC) in the basic triangle.

Description

Returns the equation, slope, intercept, and \(y\)-coordinates of the lines joining \(D_1\) and \(CC\) and also \(D_2\) and \(CC\), in the basic triangle \(T_b=T(A=(0,0),B=(1,0),C=(c_1,c_2))\) where \(c_1\) is in \([0,1/2]\), \(c_2>0\) and \((1-c_1)^2+c_2^2 \le 1\) and \(D_1=(B+C)/2\) and \(D_2=(A+C)/2\) are the midpoints of edges \(BC\) and \(AC\).

Any given triangle can be mapped to the basic triangle by a combination of rigid body motions (i.e., translation, rotation and reflection) and scaling, preserving uniformity of the points in the original triangle. Hence basic triangle is useful for simulation studies under the uniformity hypothesis. \(x\)-coordinates are provided in vector x.

Usage

lD1CCinTb(x, c1, c2)

lD2CCinTb(x, c1, c2)

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 "main" title for the plot of the line.

cent

The center chosen inside the standard equilateral triangle.

cent.name

The name of the center inside the basic triangle. It is "CC" for these two functions.

tri

The triangle (it is the basic triangle for this function).

x

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.

y

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

Slope of the line.

intercept

Intercept of the line.

equation

Equation of the line.

Arguments

x

A single scalar or a vector of scalars.

c1, c2

Positive real numbers which constitute the vertex of the basic triangle adjacent to the shorter edges; \(c_1\) must be in \([0,1/2]\), \(c_2>0\) and \((1-c_1)^2+c_2^2 \le 1\).

Author

Elvan Ceyhan

See Also

lA_CM.Te, lB_CM.Te, lA_M.Te, lB_M.Te, and lC_M.Te

Examples

Run this code
#Examples for lD1CCinTb
c1<-.4; c2<-.6;
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);  #the vertices of the basic triangle Tb

Tb<-rbind(A,B,C)

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

lnD1CC<-lD1CCinTb(x,c1,c2)
lnD1CC
summary(lnD1CC)
plot(lnD1CC)

CC<-circ.cent.bastri(c1,c2)  #the circumcenter
CC
D1<-(B+C)/2; D2<-(A+C)/2; D3<-(A+B)/2; #midpoints of the edges
Ds<-rbind(D1,D2,D3)

x1<-seq(0,1,by=.1)  #try also by=.01
y1<-lD1CCinTb(x1,c1,c2)$y

Xlim<-range(Tb[,1],x1)
Ylim<-range(Tb[,2],y1)
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]

plot(A,pch=".",asp=1,xlab="",ylab="",axes=TRUE,xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Tb)
L<-matrix(rep(CC,3),ncol=2,byrow=TRUE); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty=2)

txt<-rbind(Tb,CC,D1,D2,D3)
xc<-txt[,1]+c(-.03,.04,.03,.02,.09,-.08,0)
yc<-txt[,2]+c(.02,.02,.04,.08,.03,.03,-.05)
txt.str<-c("A","B","C","CC","D1","D2","D3")
text(xc,yc,txt.str)

lines(x1,y1,type="l",lty=2)
text(.8,.5,"lD1CCinTb")

c1<-.4; c2<-.6;
x1<-seq(0,1,by=.1)  #try also by=.01
lD1CCinTb(x1,c1,c2)

#Examples for lD2CCinTb
c1<-.4; c2<-.6;
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);  #the vertices of the basic triangle Tb

Tb<-rbind(A,B,C)

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

lnD2CC<-lD2CCinTb(x,c1,c2)
lnD2CC
summary(lnD2CC)
plot(lnD2CC)

CC<-circ.cent.bastri(c1,c2)  #the circumcenter
CC
D1<-(B+C)/2; D2<-(A+C)/2; D3<-(A+B)/2; #midpoints of the edges
Ds<-rbind(D1,D2,D3)

x2<-seq(0,1,by=.1)  #try also by=.01
y2<-lD2CCinTb(x2,c1,c2)$y

Xlim<-range(Tb[,1],x1)
Ylim<-range(Tb[,2],y2)
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]

plot(A,pch=".",asp=1,xlab="",ylab="",axes=TRUE,xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Tb)
L<-matrix(rep(CC,3),ncol=2,byrow=TRUE); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty=2)

txt<-rbind(Tb,CC,D1,D2,D3)
xc<-txt[,1]+c(-.03,.04,.03,.02,.09,-.08,0)
yc<-txt[,2]+c(.02,.02,.04,.08,.03,.03,-.05)
txt.str<-c("A","B","C","CC","D1","D2","D3")
text(xc,yc,txt.str)

lines(x2,y2,type="l",lty=2)
text(0,.5,"lD2CCinTb")

Run the code above in your browser using DataLab