Learn R Programming

pcds (version 0.1.2)

IndNPEbastri: The indicator for the presence of an arc from a point to another for Proportional Edge Proximity Catch Digraphs (PE-PCDs) - basic triangle case

Description

Returns \(I(\)pt2 is in \(N_{PE}(pt1,r))\) for points pt1 and pt2, that is, returns 1 if pt2 is in \(N_{PE}(pt1,r)\), returns 0 otherwise, where \(N_{PE}(x,r)\) is the PE proximity region for point \(x\) with expansion parameter \(r \ge 1\).

PE proximity region is defined with respect to the basic triangle \(T_b=T((0,0),(1,0),(c_1,c_2))\) where \(c_1\) is in \([0,1/2]\), \(c_2>0\) and \((1-c_1)^2+c_2^2 \le 1\).

Vertex regions are based on the center, \(M=(m_1,m_2)\) in Cartesian coordinates or \(M=(\alpha,\beta,\gamma)\) in barycentric coordinates in the interior of the basic triangle \(T_b\) or based on circumcenter of \(T_b\); default is \(M=(1,1,1)\) i.e., the center of mass of \(T_b\). rv is the index of the vertex region pt1 resides, with default=NULL.

If pt1 and pt2 are distinct and either of them are outside \(T_b\), it returns 0, but if they are identical, then it returns 1 regardless of their locations (i.e., it allows loops).

Any given triangle can be mapped to the basic triangle by a combination of rigid body motions (i.e., translation, rotation and reflection) and scaling, preserving uniformity of the points in the original triangle. Hence basic triangle is useful for simulation studies under the uniformity hypothesis.

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

Usage

IndNPEbastri(pt1, pt2, r, c1, c2, M = c(1, 1, 1), rv = NULL)

Arguments

pt1

A 2D point whose PE proximity region is constructed.

pt2

A 2D point. The function determines whether pt2 is inside the PE proximity region of pt1 or not.

r

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

c1, c2

Positive real numbers which constitute the vertex of the basic triangle adjacent to the shorter edges; \(c_1\) must be in \([0,1/2]\), \(c_2>0\) and \((1-c_1)^2+c_2^2 \le 1\).

M

A 2D point in Cartesian coordinates or a 3D point in barycentric coordinates which serves as a center in the interior of the basic triangle or circumcenter of \(T_b\); default is \(M=(1,1,1)\) i.e., the center of mass of \(T_b\).

rv

The index of the vertex region in \(T_b\) containing the point, either 1,2,3 or NULL (default is NULL).

Value

\(I(\)pt2 is in \(N_{PE}(pt1,r))\) for points pt1 and pt2, that is, returns 1 if pt2 is in \(N_{PE}(pt1,r)\), returns 0 otherwise

References

See Also

IndNPEtri and IndNPETe

Examples

Run this code
# NOT RUN {
c1<-.4; c2<-.6
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);
Tb<-rbind(A,B,C);

M<-as.numeric(runif.bastri(1,c1,c2)$g)

r<-2

P1<-as.numeric(runif.bastri(1,c1,c2)$g)
P2<-as.numeric(runif.bastri(1,c1,c2)$g)
IndNPEbastri(P1,P2,r,c1,c2,M)

P1<-c(.4,.2)
P2<-c(.5,.26)
IndNPEbastri(P1,P2,r,c1,c2,M)
IndNPEbastri(P2,P1,r,c1,c2,M)
IndNPEbastri(P1,P1,r,c1,c2,M)

#or try
Rv<-rv.bastri.cent(P1,c1,c2,M)$rv
IndNPEbastri(P1,P2,r,c1,c2,M,Rv)

P1<-c(1.4,.2)
P2<-c(.5,.26)
IndNPEbastri(P1,P2,r,c1,c2,M)
IndNPEbastri(P1,P1,r,c1,c2,M)

#or try
Rv<-rv.bastri.cent(P1,c1,c2,M)$rv
IndNPEbastri(P1,P2,r,c1,c2,M,Rv)
IndNPEbastri(P1,P1,r,c1,c2,M,Rv)

P1<-c(.4,.2)
P2<-c(1.5,.26)
IndNPEbastri(P1,P2,r,c1,c2,M)

P1<-c(.4,.2)
P2<-c(.5,.26)
IndNPEbastri(P1,P2,r,c1,c2,M)

# }

Run the code above in your browser using DataLab