Learn R Programming

pcds (version 0.1.4)

Gam2PEtetra: The indicator for two 3D points constituting a dominating set for Proportional Edge Proximity Catch Digraphs (PE-PCDs) - one tetrahedron case

Description

Returns \(I(\){pt1,pt2} is a dominating set of the PE-PCD\()\) where the vertices of the PE-PCD are the 3D data set Dt in the tetrahedron th, that is, returns 1 if {pt1,pt2} is a dominating set of PE-PCD, returns 0 otherwise.

Point, pt1, is in the region of vertex rv1 (default is NULL) and point, pt2, is in the region of vertex rv2 (default is NULL); vertices (and hence rv1 and rv2) are labeled as 1,2,3,4 in the order they are stacked row-wise in th.

PE proximity region is constructed with respect to the tetrahedron th with expansion parameter \(r \ge 1\) and vertex regions are based on center of mass (M="CM") or circumcenter (M="CC") only.

ch.data.pnts is for checking whether points pt1 and pt2 are both data points in Dt or not (default is FALSE), so by default this function checks whether the points pt1 and pt2 would constitute a dominating set if they actually were both in the data set.

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

Usage

Gam2PEtetra(
  pt1,
  pt2,
  Dt,
  r,
  th,
  M = "CM",
  rv1 = NULL,
  rv2 = NULL,
  ch.data.pnts = FALSE
)

Value

\(I(\){pt1,pt2} is a dominating set of the PE-PCD\()\) where the vertices of the PE-PCD are the 3D data set Dt), that is, returns 1 if {pt1,pt2} is a dominating set of PE-PCD, returns 0 otherwise

Arguments

pt1, pt2

Two 3D points to be tested for constituting a dominating set of the PE-PCD.

Dt

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

th

Four 3D points, stacked row-wise, each row representing a vertex of the tetrahedron.

M

The center to be used in the construction of the vertex regions in the tetrahedron, th. Currently it only takes "CC" for circumcenter and "CM" for center of mass; default="CM".

rv1, rv2

The indices of the vertices whose regions contains pt1 and pt2, respectively. They take the vertex labels as 1,2,3,4 as in the row order of the vertices in th (default is NULL for both).

ch.data.pnts

A logical argument for checking whether both points pt1 and pt2 are data points in Dt or not (default is FALSE).

Author

Elvan Ceyhan

References

See Also

Gam2PEstdTetra, Gam2PEtri and Gam2PEbastri

Examples

Run this code
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<-20

dat<-runif.tetra(n,tetra)$g  #try also dat<-cbind(runif(n),runif(n),runif(n))

M<-"CM";  #try also M<-"CC";
r<-1.5

Gam2PEtetra(dat[1,],dat[2,],dat,r,tetra,M)
Gam2PEtetra(dat[1,],dat[1,],dat,r,tetra,M)

Gam2PEtetra(c(-1,-1,-1),dat[2,],dat,r,tetra,M)

Gam2PEtetra(c(-1,-1,-1),c(-1,-1,-2),rbind(c(-1,-1,-1),c(-1,-1,-2)),r,tetra,M)

ind.gam2<-ind.gamn2<-vector()
for (i in 1:(n-1))
 for (j in (i+1):n)
 {if (Gam2PEtetra(dat[i,],dat[j,],dat,r,tetra,M)==1)
 {ind.gam2<-rbind(ind.gam2,c(i,j))
 }
 }
ind.gam2

#or try
rv1<-rv.tetraCC(dat[1,],tetra)$rv;rv2<-rv.tetraCC(dat[2,],tetra)$rv
Gam2PEtetra(dat[1,],dat[2,],dat,r,tetra,M,rv1,rv2)

#or try
rv1<-rv.tetraCC(dat[1,],tetra)$rv;
Gam2PEtetra(dat[1,],dat[2,],dat,r,tetra,M,rv1)

#or try
rv2<-rv.tetraCC(dat[2,],tetra)$rv
Gam2PEtetra(dat[1,],dat[2,],dat,r,tetra,M,rv2=rv2)

P1<-c(.1,.1,.1)
P2<-c(.4,.1,.2)
Gam2PEtetra(P1,P2,dat,r,tetra,M)

dat.fr<-data.frame(a=dat)
Gam2PEtetra(P1,P2,dat.fr,r,tetra,M)

Gam2PEtetra(c(-1,-1,-1),dat[2,],dat,r,tetra,M,ch.data.pnts = FALSE)
#gives an error message if ch.data.pnts = TRUE
#since not both points, pt1 and pt2, are data points in Dt

Run the code above in your browser using DataLab