cl2edgesMvert.reg: The closest points among a data set in the vertex regions to...

View source: R/AuxExtrema.R

cl2edgesMvert.regR Documentation

The closest points among a data set in the vertex regions to the respective edges in a 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 triangle tri=T(A,B,C). 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 triangle tri or based on the circumcenter of tri.

Two methods of finding these extrema are provided in the function, which can be chosen in the logical argument alt, whose default is alt=FALSE. When alt=FALSE, the function sequentially finds the vertex region of the data point and then updates the minimum distance to the opposite edge and the relevant extrema objects, and when alt=TRUE, it first partitions the data set according which vertex regions they reside, and then finds the minimum distance to the opposite edge and the relevant extrema on each partition. Both options yield equivalent results for the extrema points and indices, with the default being slightly ~ 20

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

Usage

cl2edgesMvert.reg(Xp, tri, M, alt = FALSE)

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.

M

A 2D point in Cartesian coordinates or a 3D point in barycentric coordinates which serves as a center in the interior of the triangle tri or the circumcenter of tri; which may be entered as "CC" as well;

alt

A logical argument for alternative method of finding the closest points to the edges, default alt=FALSE. When alt=FALSE, the function sequentially finds the vertex region of the data point and then the minimum distance to the opposite edge and the relevant extrema objects, and when alt=TRUE, it first partitions the data set according which vertex regions they reside, and then finds the minimum distance to the opposite edge and the relevant extrema on each partition.

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 respective vertex region.

ind.ext

The data indices of 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 "M" or "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 M-vertex regions to corresponding edges.

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

cl2edges.vert.reg.basic.tri, cl2edgesCMvert.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

M<-as.numeric(runif.tri(1,Tr)$g)  #try also M<-c(1.6,1.0)

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

cl2e<-Ext

Ds<-prj.cent2edges(Tr,M)

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

if (dimension(M)==3) {M<-bary2cart(M,Tr)}
#need to run this when M is given in barycentric coordinates

plot(Tr,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(Tr)
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<-Tr[,1]+c(-.02,.03,.02)
yc<-Tr[,2]+c(.02,.02,.04)
txt.str<-c("A","B","C")
text(xc,yc,txt.str)

txt<-rbind(M,Ds)
xc<-txt[,1]+c(-.02,.05,-.02,-.01)
yc<-txt[,2]+c(-.03,.02,.08,-.07)
txt.str<-c("M","D1","D2","D3")
text(xc,yc,txt.str)

## End(Not run)


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