Idom.num1PEstd.tetra: The indicator for a 3D point being a dominating point for...

View source: R/PropEdge3D.R

Idom.num1PEstd.tetraR Documentation

The indicator for a 3D point being a dominating point for Proportional Edge Proximity Catch Digraphs (PE-PCDs) - standard regular tetrahedron case

Description

Returns I(p is a dominating point of the PE-PCD) where the vertices of the PE-PCD are the 3D data set Xp in the standard regular tetrahedron T_h=T((0,0,0),(1,0,0),(1/2,\sqrt{3}/2,0),(1/2,\sqrt{3}/6,\sqrt{6}/3)), that is, returns 1 if p is a dominating point of PE-PCD, returns 0 otherwise.

Point, p, is in the vertex region of vertex rv (default is NULL); vertices are labeled as 1,2,3,4 in the order they are stacked row-wise in T_h.

PE proximity region is constructed with respect to the tetrahedron T_h with expansion parameter r \ge 1 and vertex regions are based on center of mass CM (equivalent to circumcenter in this case).

ch.data.pnt is for checking whether point p is a data point in Xp or not (default is FALSE), so by default this function checks whether the point p would be a dominating point if it actually were in the data set.

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

Usage

Idom.num1PEstd.tetra(p, Xp, r, rv = NULL, ch.data.pnt = FALSE)

Arguments

p

A 3D point that is to be tested for being a dominating point or not of the PE-PCD.

Xp

A set of 3D points which constitutes the vertices of the PE-PCD.

r

A positive real number which serves as the expansion parameter in PE proximity region; must be \ge 1.

rv

Index of the vertex whose region contains point p, rv takes the vertex labels as 1,2,3,4 as in the row order of the vertices in standard regular tetrahedron, default is NULL.

ch.data.pnt

A logical argument for checking whether point p is a data point in Xp or not (default is FALSE).

Value

I(p is a dominating point of the PE-PCD) where the vertices of the PE-PCD are the 3D data set Xp, that is, returns 1 if p is a dominating point, returns 0 otherwise

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

Idom.num1PEtetra, Idom.num1PEtri and Idom.num1PEbasic.tri

Examples

## Not run: 
set.seed(123)
A<-c(0,0,0); B<-c(1,0,0); C<-c(1/2,sqrt(3)/2,0); D<-c(1/2,sqrt(3)/6,sqrt(6)/3)
tetra<-rbind(A,B,C,D)

n<-5 #try also n<-20
Xp<-runif.std.tetra(n)$g  #try also Xp<-cbind(runif(n),runif(n),runif(n))
r<-1.5

P<-c(.4,.1,.2)
Idom.num1PEstd.tetra(Xp[1,],Xp,r)
Idom.num1PEstd.tetra(P,Xp,r)

Idom.num1PEstd.tetra(Xp[1,],Xp,r)
Idom.num1PEstd.tetra(Xp[1,],Xp[1,],r)

#or try
RV<-rel.vert.tetraCC(Xp[1,],tetra)$rv
Idom.num1PEstd.tetra(Xp[1,],Xp,r,rv=RV)

Idom.num1PEstd.tetra(c(-1,-1,-1),Xp,r)
Idom.num1PEstd.tetra(c(-1,-1,-1),c(-1,-1,-1),r)

gam.vec<-vector()
for (i in 1:n)
{gam.vec<-c(gam.vec,Idom.num1PEstd.tetra(Xp[i,],Xp,r))}

ind.gam1<-which(gam.vec==1)
ind.gam1
g1.pts<-Xp[ind.gam1,]

Xlim<-range(tetra[,1],Xp[,1])
Ylim<-range(tetra[,2],Xp[,2])
Zlim<-range(tetra[,3],Xp[,3])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
zd<-Zlim[2]-Zlim[1]

plot3D::scatter3D(Xp[,1],Xp[,2],Xp[,3], phi =0,theta=40, bty = "g",
xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05), zlim=Zlim+zd*c(-.05,.05),
         pch = 20, cex = 1, ticktype = "detailed")
#add the vertices of the tetrahedron
plot3D::points3D(tetra[,1],tetra[,2],tetra[,3], add=TRUE)
L<-rbind(A,A,A,B,B,C); R<-rbind(B,C,D,C,D,D)
plot3D::segments3D(L[,1], L[,2], L[,3], R[,1], R[,2],R[,3], add=TRUE,lwd=2)
if (length(g1.pts)!=0)
{
  if (length(g1.pts)==3) g1.pts<-matrix(g1.pts,nrow=1)
  plot3D::points3D(g1.pts[,1],g1.pts[,2],g1.pts[,3], pch=4,col="red", add=TRUE)}

plot3D::text3D(tetra[,1],tetra[,2],tetra[,3], labels=c("A","B","C","D"), add=TRUE)

CM<-apply(tetra,2,mean)
D1<-(A+B)/2; D2<-(A+C)/2; D3<-(A+D)/2; D4<-(B+C)/2; D5<-(B+D)/2; D6<-(C+D)/2;
L<-rbind(D1,D2,D3,D4,D5,D6); R<-matrix(rep(CM,6),ncol=3,byrow=TRUE)
plot3D::segments3D(L[,1], L[,2], L[,3], R[,1], R[,2],R[,3], add=TRUE,lty=2)

P<-c(.4,.1,.2)
Idom.num1PEstd.tetra(P,Xp,r)

Idom.num1PEstd.tetra(c(-1,-1,-1),Xp,r,ch.data.pnt = FALSE)
#gives an error message if ch.data.pnt = TRUE

## End(Not run)


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