funsAB2CMTe {pcds}R Documentation

The lines joining two vertices to the center of mass in standard equilateral triangle

Description

Two functions, lineA2CMinTe and lineB2CMinTe of class "TriLines". Returns the equation, slope, intercept, and y-coordinates of the lines joining A and CM and also B and CM.

lineA2CMinTe is the line joining A to the center of mass, CM, and lineB2CMinTe is the line joining B to the center of mass, CM, 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

lineA2CMinTe(x)

lineB2CMinTe(x)

Arguments

x

A single scalar or a vector of scalars which is the argument of the functions lineA2CMinTe and lineB2CMinTe.

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 equilateral triangle. It is "CM" for these two functions.

tri

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

Author(s)

Elvan Ceyhan

See Also

lineA2MinTe, lineB2MinTe, and lineC2MinTe

Examples


#Examples for lineA2CMinTe
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-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

lnACM<-lineA2CMinTe(x)
lnACM
summary(lnACM)
plot(lnACM)

CM<-(A+B+C)/3;
D1<-(B+C)/2; D2<-(A+C)/2; D3<-(A+B)/2;
Ds<-rbind(D1,D2,D3)

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<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty = 2)

txt<-rbind(Te,CM,D1,D2,D3,c(.25,lineA2CMinTe(.25)$y),c(.75,lineB2CMinTe(.75)$y))
xc<-txt[,1]+c(-.02,.02,.02,.05,.05,-.03,.0,0,0)
yc<-txt[,2]+c(.02,.02,.02,.02,0,.02,-.04,0,0)
txt.str<-c("A","B","C","CM","D1","D2","D3","lineA2CMinTe(x)","lineB2CMinTe(x)")
text(xc,yc,txt.str)

lineA2CMinTe(.25)$y



#Examples for lineB2CMinTe
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-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

lnBCM<-lineB2CMinTe(x)
lnBCM
summary(lnBCM)
plot(lnBCM,xlab=" x",ylab="y")

lineB2CMinTe(.25)$y



[Package pcds version 0.1.8 Index]