cl2edgesMvert.reg | R Documentation |
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).
cl2edgesMvert.reg(Xp, tri, M, alt = FALSE)
Xp |
A set of 2D points representing the set of data points. |
tri |
A |
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 |
alt |
A logical argument for alternative method of
finding the closest points to the edges,
default |
A list
with the elements
txt1 |
Vertex labels are |
txt2 |
A short description of the distances
as |
type |
Type of the extrema points |
desc |
A short description of the extrema points |
mtitle |
The |
ext |
The extrema points, here, closest points to edges in the respective vertex region. |
ind.ext |
The data indices of extrema points, |
X |
The input data, |
num.points |
The number of data points, i.e., size of |
supp |
Support of the data points, here, it is |
cent |
The center point used for construction of vertex regions |
ncent |
Name of the center, |
regions |
Vertex regions
inside the triangle, |
region.names |
Names of the vertex regions
as |
region.centers |
Centers of mass of the vertex regions
inside |
dist2ref |
Distances of closest points
in the |
Elvan Ceyhan
cl2edges.vert.reg.basic.tri
, cl2edgesCMvert.reg
,
and cl2edges.std.tri
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.