Learn R Programming

pcds (version 0.1.8)

IarcAStri: 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(p2 \in N_{AS}(p1))\) for points p1 and p2, that is, returns 1 if \(p2\) is in \(N_{AS}(p1)\), 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=(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 circumcenter of tri; default is M="CC", i.e., circumcenter of tri. rv is the index of the vertex region p1 resides, with default=NULL.

If p1 and p2 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

IarcAStri(p1, p2, tri, M = "CC", rv = NULL)

Value

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

Arguments

p1

A 2D point whose AS proximity region is constructed.

p2

A 2D point. The function determines whether p2 is inside the AS proximity region of p1 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

IarcASbasic.tri, IarcPEtri, and IarcCStri

Examples

Run this code
# \donttest{
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)
IarcAStri(P1,P2,Tr,M)

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

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

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

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

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

#or try
Rv<-rel.vert.triCC(P5,Tr)$rv
IarcAStri(P5,P5,Tr,M,Rv)
# }

Run the code above in your browser using DataLab