Learn R Programming

pcds (version 0.1.4)

IndNAStri: The indicator for the presence of an arc from a point to another for Arc Slice Proximity Catch Digraphs (AS-PCDs) - one triangle case

Description

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

AS proximity regions are constructed with respect to the triangle, tri\(=T(A,B,C)=\)(rv=1,rv=2,rv=3), and vertex regions are based on the center M="CC" for circumcenter of tri; or \(M=(m_1,m_2)\) in Cartesian coordinates or \(M=(\alpha,\beta,\gamma)\) in barycentric coordinates in the interior of the triangle tri; default is M="CC" i.e., circumcenter of tri. 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 tri, the function returns 0, but if they are identical, then it returns 1 regardless of their locations (i.e., it allows loops).

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

Usage

IndNAStri(pt1, pt2, tri, M = "CC", rv = NULL)

Value

\(I(pt2 \in N_{AS}(pt1))\) for pt1, that is, returns 1 if \(pt2\) is in \(N_{AS}(pt1)\), returns 0 otherwise

Arguments

pt1

A 2D point whose AS proximity region is constructed.

pt2

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

tri

Three 2D points, stacked row-wise, each row representing a vertex of the triangle.

M

The center of the triangle. "CC" stands for circumcenter of the triangle tri or a 2D point in Cartesian coordinates or a 3D point in barycentric coordinates which serves as a center in the interior of tri; default is M="CC" i.e., the circumcenter of tri.

rv

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

Author

Elvan Ceyhan

References

See Also

IndNASbastri, IndNPEtri, and IndNCStri

Examples

Run this code
A<-c(1,1); B<-c(2,0); C<-c(1.5,2);

Tr<-rbind(A,B,C);

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

P1<-as.numeric(runif.tri(1,Tr)$g)
P2<-as.numeric(runif.tri(1,Tr)$g)
IndNAStri(P1,P2,Tr,M)

P1<-c(1.3,1.2)
P2<-c(1.8,.5)
IndNAStri(P1,P2,Tr,M)
IndNAStri(P1,P1,Tr,M)

#or try
Rv<-rv.triCC(P1,Tr)$rv
IndNAStri(P1,P2,Tr,M,Rv)

P3<-c(1.6,1.4)
IndNAStri(P1,P3,Tr,M)

P4<-c(1.5,1.0)
IndNAStri(P1,P4,Tr,M)

P5<-c(.5,1.0)
IndNAStri(P1,P5,Tr,M)
IndNAStri(P5,P5,Tr,M)

#or try
Rv<-rv.triCC(P5,Tr)$rv
IndNAStri(P5,P5,Tr,M,Rv)

dat.fr<-data.frame(a=Tr)
IndNAStri(P1,P2,dat.fr,M)

Run the code above in your browser using DataLab