cl2edgesCCvert.reg: The closest points in a data set to edges in each CC-vertex...

View source: R/AuxExtrema.R

cl2edgesCCvert.regR Documentation

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, Xp, 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 (\insertCiteceyhan:Phd-thesis,ceyhan:comp-geo-2010;textualpcds).

Usage

cl2edgesCCvert.reg(Xp, tri)

Arguments

Xp

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

tri

A 3 \times 2 matrix with each row representing a vertex of the triangle.

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

ind.ext

Indices of the extrema points,ext.

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 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

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

cl2edges.vert.reg.basic.tri, cl2edgesCMvert.reg, cl2edgesMvert.reg, and cl2edges.std.tri

Examples

## Not run: 
A<-c(1,1); B<-c(2,0); C<-c(1.5,2);
Tr<-rbind(A,B,C);

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

Ext<-cl2edgesCCvert.reg(Xp,Tr)
Ext
summary(Ext)
plot(Ext)

cl2e<-Ext

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

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

plot(Tr,asp=1,pch=".",xlab="",ylab="",
main="Closest Points in CC-Vertex Regions \n to the Opposite Edges",
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(Xp,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)

## End(Not run)


elvanceyhan/pcds documentation built on June 29, 2023, 8:12 a.m.