Learn R Programming

pcds (version 0.1.6)

cl2edgesVRbas.tri: The closest points among a data set in the vertex regions to the corresponding edges in a standard basic triangle

Description

An object of class "Extrema". Returns the closest data points among the data set, Xp, to edge \(i\) in M-vertex region \(i\) for \(i=1,2,3\) 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\). Vertex labels are \(A=1\), \(B=2\), and \(C=3\), and corresponding edge labels are \(BC=1\), \(AC=2\), and \(AB=3\).

Vertex regions are based on center \(M=(m_1,m_2)\) in Cartesian coordinates or \(M=(\alpha,\beta,\gamma)\) in barycentric coordinates in the interior of the standard basic triangle \(T_b\) or based on the circumcenter of \(T_b\).

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.

See also (ceyhan:Phd-thesis,ceyhan:comp-geo-2010,ceyhan:dom-num-NPE-Spat2011;textualpcds).

Usage

cl2edgesVRbas.tri(Xp, c1, c2, M)

Value

A list with the elements

txt1

Vertex labels are \(A=1\), \(B=2\), and \(C=3\) (correspond to row number in Extremum Points).

txt2

A short description of the distances as "Distances to Edges in the Respective \eqn{M}-Vertex Regions".

type

Type of the extrema points

desc

A short description of the extrema points

mtitle

The "main" title for the plot of the extrema

ext

The extrema points, here, closest points to edges in the corresponding vertex region.

X

The input data, Xp, can be a matrix or data frame

num.points

The number of data points, i.e., size of Xp

supp

Support of the data points, here, it is \(T_b\).

cent

The center point used for construction of vertex regions

ncent

Name of the center, cent, it is "M" or "CC" for this function

regions

Vertex regions inside the triangle, \(T_b\).

region.names

Names of the vertex regions as "vr=1", "vr=2", and "vr=3"

region.centers

Centers of mass of the vertex regions inside \(T_b\).

dist2ref

Distances of closest points in the vertex regions to corresponding edges.

Arguments

Xp

A set of 2D points representing the set of data points.

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\).

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 basic triangle \(T_b\) or the circumcenter of \(T_b\).

Author

Elvan Ceyhan

References

See Also

cl2edgesCM_VR, cl2edgesM_VR, and cl2edges.std.tri

Examples

Run this code
if (FALSE) {
c1<-.4;  c2<-.6
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);
Tb<-rbind(A,B,C);

set.seed(1)
n<-20
Xp<-runif.bas.tri(n,c1,c2)$g

M<-as.numeric(runif.bas.tri(1,c1,c2)$g)  #try also M<-c(.6,.3)

Ext<-cl2edgesVRbas.tri(Xp,c1,c2,M)
Ext
summary(Ext)
plot(Ext)

cl2e<-Ext

Ds<-cent2edges.bas.tri(c1,c2,M)

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

plot(Tb,pch=".",xlab="",ylab="",main="Closest Points in M-Vertex Regions \n to the Opposite Edges",
axes=TRUE,xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Tb)
points(Xp,pch=1,col=1)
L<-rbind(M,M,M); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty=2)
points(cl2e$ext,pch=3,col=2)

xc<-Tb[,1]+c(-.02,.02,0.02)
yc<-Tb[,2]+c(.02,.02,.02)
txt.str<-c("A","B","C")
text(xc,yc,txt.str)

txt<-rbind(M,Ds)
xc<-txt[,1]+c(-.02,.04,-.03,0)
yc<-txt[,2]+c(-.02,.02,.02,-.03)
txt.str<-c("M","D1","D2","D3")
text(xc,yc,txt.str)
}

Run the code above in your browser using DataLab