Learn R Programming

pcds (version 0.1.8)

funsTbMid2CC: Two functions lineD1CCinTb and lineD2CCinTb which are of class "TriLines" --- The lines joining the midpoints of edges to the circumcenter (\(CC\)) in the standard 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 standard 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 standard 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 standard basic triangle is useful for simulation studies under the uniformity hypothesis. \(x\)-coordinates are provided in vector x.

Usage

lineD1CCinTb(x, c1, c2)

lineD2CCinTb(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 standard basic triangle. It is "CC" for these two functions.

tri

The triangle (it is the standard 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 standard 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

lineA2CMinTe, lineB2CMinTe, lineA2MinTe, lineB2MinTe, and lineC2MinTe

Examples

Run this code
# \donttest{
#Examples for lineD1CCinTb
c1<-.4; c2<-.6;
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);  #the vertices of the standard 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<-lineD1CCinTb(x,c1,c2)
lnD1CC
summary(lnD1CC)
plot(lnD1CC)

CC<-circumcenter.basic.tri(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<-lineD1CCinTb(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,"lineD1CCinTb")

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

# \donttest{
#Examples for lineD2CCinTb
c1<-.4; c2<-.6;
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);  #the vertices of the standard 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<-lineD2CCinTb(x,c1,c2)
lnD2CC
summary(lnD2CC)
plot(lnD2CC)

CC<-circumcenter.basic.tri(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<-lineD2CCinTb(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,"lineD2CCinTb")
# }

Run the code above in your browser using DataLab