Learn R Programming

pcds (version 0.1.4)

cl2eVRCC: The closest points in a data set to edges in each \(CC\)-vertex region in a triangle

Description

An object of class "Extrema". Returns the closest data points among the data set, dat, to edge \(j\) in \(CC\)-vertex region \(j\) for \(j=1,2,3\) in the triangle, tri\(=T(A,B,C)\), where \(CC\) stands for circumcenter. Vertex labels are \(A=1\), \(B=2\), and \(C=3\), and corresponding edge labels are \(BC=1\), \(AC=2\), and \(AB=3\). Function yields NA if there are no data points in a \(CC\)-vertex region.

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

Usage

cl2eVRCC(dat, tri)

Value

A list with the elements

txt1

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

txt2

A short description of the distances as "Distances to Edges in the Respective CC-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 respective vertex region.

X

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

num.points

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

supp

Support of the data points, here, it is tri

cent

The center point used for construction of vertex regions

ncent

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

regions

Vertex regions inside the triangle, tri, provided as a list

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 tri

dist2ref

Distances of closest points in the vertex regions to corresponding edges

Arguments

dat

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

tri

Three 2D points, stacked row-wise, each row representing a vertex of the triangle.

Author

Elvan Ceyhan

References

See Also

cl2eTbVRcent, cl2eVRCM, cl2eVRcent, and cl2edgesTe

Examples

Run this code
A<-c(1,1); B<-c(2,0); C<-c(1.5,2);
Tr<-rbind(A,B,C);

n<-10  #try also n<-20
set.seed(1)
dat<-runif.tri(n,Tr)$g

Ext<-cl2eVRCC(dat,Tr)
Ext
summary(Ext)
plot(Ext)

cl2eVRCC(dat[1,],Tr)

cl2e<-cl2eVRCC(dat,Tr)
cl2e

CC<-circ.cent.tri(Tr);
D1<-(B+C)/2; D2<-(A+C)/2; D3<-(A+B)/2;
Ds<-rbind(D1,D2,D3)

Xlim<-range(Tr[,1],dat[,1],CC[1])
Ylim<-range(Tr[,2],dat[,2],CC[2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]

plot(Tr,asp=1,pch=".",xlab="",ylab="",axes=TRUE,xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Tr)

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

points(dat,pch=1,col=1)
L<-matrix(rep(CC,3),ncol=2,byrow=TRUE); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty=2)
points(cl2e$ext,pch=3,col=2)

txt<-rbind(CC,Ds)
xc<-txt[,1]+c(-.04,.04,-.03,0)
yc<-txt[,2]+c(-.05,.04,.06,-.08)
txt.str<-c("CC","D1","D2","D3")
text(xc,yc,txt.str)

P<-c(1.4,1.0)
cl2eVRCC(P,Tr)
cl2eVRCC(dat,Tr)

cl2eVRCC(rbind(dat,dat),Tr)

dat.fr<-data.frame(a=dat)
cl2eVRCC(dat.fr,Tr)

dat.fr<-data.frame(a=Tr)
cl2eVRCC(dat,dat.fr)

Run the code above in your browser using DataLab