Distance Distributions in Regular Polygons
Abstract
This paper derives the exact cumulative density function of the distance between a randomly located node and any arbitrary reference point inside a regular sided polygon. Using this result, we obtain the closedform probability density function (PDF) of the Euclidean distance between any arbitrary reference point and its th neighbour node, when nodes are uniformly and independently distributed inside a regular sided polygon. First, we exploit the rotational symmetry of the regular polygons and quantify the effect of polygon sides and vertices on the distance distributions. Then we propose an algorithm to determine the distance distributions given any arbitrary location of the reference point inside the polygon. For the special case when the arbitrary reference point is located at the center of the polygon, our framework reproduces the existing result in the literature.
I Introduction
Recently, the distance distributions in wireless networks have received a lot of attention in the literature [1, 2, 3]. The distance distributions can be applied to study important wireless network characteristics such as interference, outage probability, connectivity, routing and energy consumption [1, 4, 5, 6]. The distance distributions in wireless networks are dependent on the location of the nodes, which are seen as realizations of some spatial point process. When the node locations follows an infinite homogeneous Poisson point process, the probability density function (PDF) of the Euclidean distance between a point and its th neighbour node follows a generalised Gamma distribution [7]. However, as recently identified in [1, 2, 8, 9], this model does not accurately reflect the distance distributions in many practical wireless networks where a fixed and finite number of nodes are uniformly and independently distributed over a finite area such as square or hexagon or disk region. Note that these finite regions of interest can be conveniently modeled as special cases of a regular sided polygon (referred to as gon for brevity), e.g., correspond to equilateral triangle, square, hexagon and disk respectively. In this context, the two important distance distributions are: (i) the PDF of the Euclidean distance between two nodes uniformly and independently distributed inside a gon and (ii) the PDF of the Euclidean distance between any arbitrary reference point and its th neighbour node, when nodes are uniformly and independently distributed inside a gon. For the first case, the PDF of the distance between two nodes uniformly and independently distributed inside an equilateral triangle [10], square [11, 12], hexagon [13, 3] and disk [11] are well known in the literature. These results are special cases of the general result obtained recently in [14]. For the second case, the PDF of the Euclidean distance to the th neighbour node is obtained in [1] for the special case when the reference point is located at the center of the gon.
In this correspondence, we present a general framework for analytically obtaining the exact cumulative density function of the distance between a randomly located node and any arbitrary reference point inside a regular sided polygon. Using this result, we obtain the closedform PDF of the Euclidean distance between any arbitrary reference point and its th neighbour node, when nodes are uniformly and independently distributed inside a regular sided polygon. The proposed framework is based on characterising the overlap area between the gon and a disk centered at the arbitrary reference point located inside the gon. There are two key insights which lead to our results: the use of the rotation operator that simplifies the characterisation of distances and overlap areas, and the systematic analysis of the effect of gon sides and vertices on the overlap area. Based on our proposed framework, we formulate an algorithm to determine the distance distributions given any location of the reference point inside the polygon. We provide examples to demonstrate the generality of our proposed framework. We also show that the result in [1] can be obtained as a special case in our framework.
Ii System Model
Consider nodes which are uniformly and independently distributed inside a regular sided polygon , where denotes the two dimensional Euclidean domain. Let denote an arbitrary reference point located inside the gon, where denotes transpose of a vector.
Iia Polygon geometry
Without loss of generality, we assume that the gon is inscribed in a circle of radius and is centered at the origin . Then, its inradius is and its area is given by
(1) 
Let and denotes the sides and vertices of the polygon, for , which are numbered in anticlockwise direction, as shown in Fig. 1. We assume that the first vertex of the polygon is at , i.e., at the intersection of the circle inscribing the polygon and the axis. The interior angle of the polygon and the central angle between two adjacent vertices are given by
(2) 
IiB Rotation operator
For compact representation, we define the rotation operator which rotates an arbitrary point anticlockwise around the origin by an angle . The rotated point can thus be expressed as
(3) 
where is the corresponding rotation matrix of and is given by
(4) 
Also define as the inverse rotation operator with rotation matrix , which rotates an arbitrary point clockwise around the origin by an angle . We note that the rotation under the operator is an isometric operation which preserves the distances between any two points in the two dimensional plane, i.e., and , where denotes the identity matrix.
IiC Distances from the polygon sides and vertices
In this subsection, we find the distances from an arbitrary reference point located inside the polygon to all its sides and vertices. First, we examine the distance to any vertex. Using the geometry, the distance between the point and the vertex is given by
(5) 
In order to find the distances to the remaining vertices, we use and exploit the rotational symmetry of the gon. By appropriately rotating the point and then finding its distance from vertex , we can in fact, find the distance to other vertices. Thus, using (5) and the rotation operator defined in (3), we can express as
(6) 
Next, we examine the distance to any side. We define this distance to any side as the shortest distance between the point and the line segment formed by the side of the polygon. If the projection of the point onto a side lies inside the side, then the shortest distance is given by the perpendicular distance between the point and the side. If the projection of the point onto a side does not lie on the side, then the shortest distance is the minimum of the distance to the side endpoints. Using the geometry, the perpendicular distance from an arbitrary point to the line segment formed by side is given by
(7) 
where denotes the absolute value. The distance to the side endpoints is simply given by and . Thus, the shortest distance to the side can be expressed as
(8) 
where denotes the perpendicular projection of onto the line segment formed by side , is the side length of the gon and and denote the minimum and maximum values respectively. Then, using (3), we can express and as
(9) 
Iii Problem Formulation
Consider a disk of radius centered at the arbitrary reference point . First, we define the probability that a random node, which is uniformly distributed inside the gon , lies at a distance of less than or equal to from the point .
Definition 2
Define the cumulative density function (CDF) , which is the probability that a random node falls inside a disk of radius centered at the arbitrary reference point , as
(11) 
where is the overlap area between the disk and gon .
Then the PDF of the distance from an arbitrary point to the th neighbour node is [1]
(12) 
where is the number nodes are which are uniformly and independently distributed inside the gon, is the beta function, denotes the gamma function, denotes the partial derivative respect to the variable and is given in (11).
The challenge in evaluating (11) and (12) is finding the overlap area . When the reference point is located at the center of the gon, the overlap area can be easily evaluated as shown in [1]. For (where is the gon inradius defined above (1)), the disk is entirely inside the gon . Thus the overlap area is the same as the area of the disk, i.e, . For , (where is the gon circumradius) there are circular segment shaped portions of the disk which are outside the gon. Since these circular segments are symmetric and there is no overlap between them, the overlap area is given by . Note that in this case it is simple to find the area of one circular segment using geometry.
When the reference point is not located at the center, then the circular segments are no longer symmetric. This is illustrated in Fig. 2 for the case of a square () for simplicity. We can see that for the given radius of the disk centered at the reference point, nonsymmetric circular segment areas are formed outside the sides , and . In addition, there is overlap between the circular segment areas formed outside the sides and . This complicates the task of finding the overlap area . Also, for any arbitrary location of the reference point, the different ranges for are no longer exclusively determined by the inradius and circumradius , but by the number of unique distances from the reference point to the vertices and the sides. This adds further complexity to the task of finding the overlap area .
Iv Characterization of the Effect of Sides and Vertices
In this section, we characterize the effect of polygon sides and vertices on the overlap area . Because of the symmetry of the polygon, we only need to consider the following three cases which are illustrated in Fig. 3. Other cases can be handled as an appropriate combination of these cases:

The overlap area is limited by one side of the polygon only. This is illustrated in Fig. 3(a) for side .

The overlap area is limited by two sides of the polygon and there is no overlap between them. This is illustrated in Fig. 3(b) for sides and .

The overlap area is limited by two sides of the polygon and there is overlap between them. This is illustrated in Fig. 3(c) for side and and vertex .
These cases are discussed in detail in the following subsections.
Iva Case 1: Overlap area limited by one side only
IvB Case 2: Overlap area limited by two sides with no overlap
IvC Case 3: Overlap area limited by two sides with overlap
This case is illustrated in Fig. 3(c), where there is overlap between the two circular segments, and , formed outside sides and due to the inclusion of the vertex . Let denote this overlap region between the two circular segments. Thus, in this case, the overlap area is given by .
Using polar coordinates, we can find the area by integrating the angle (shown in Fig. 3(c)) over as
(15) 
V Distance Distributions in Polygons
In this section, we present our algorithm to use the distance vector in (10) and the effect of different sides and vertices ((IVA)(16)) in order to find the overlap area given any arbitrary reference point located inside the gon .
The overall effect of the sides and vertices of the gon depends on the range of the distance and on the distance between the reference point and all the sides and vertices. Since an gon has sides and vertices, there can be different ranges for the distance . We sort the distance vector in (10) in ascending order and define to be the sorted distance vector. Then, the first range of the distance is , where denotes the first entry of the sorted distance vector . The next ranges are and the last range is . Thus, in general, we can write an expression for as
(17) 
where the subscript in denotes the overlap area for the th range.
For the first range , , since the disk will be completely inside the gon. For the last range , , since the disk will completely overlap with the gon . For the intermediate ranges, the overlap area may be limited by any number of sides, with or without overlap between any two adjacent sides. Also depending on the location of the arbitrary reference point, some of the distance to the sides and vertices may be the same. In order to automate the process of finding the unique set of ranges for the distance and to calculate the corresponding overlap area for each unique range, we propose the Algorithm 1.
In the proposed algorithm, we sort the distance vector
in (10) in ascending order to obtain
the sorted distance vector and the index vector
. The index vector
is then used to find the effect of sides and vertices
on the overlap area for each value of range. For each unique range
which is determined in the outer for
loop, we evaluate the overlap area in
(17) in the inner for
loop by taking into account the
cumulative effect of all of the sides and vertices. The terms and are appropriately selected using the index
vector . Once in (17) is computed for each unique range, it can then used to
evaluate (11) and (12). We have implemented the proposed algorithm in MATLAB
Va Algorithm illustration  arbitrary reference point in a square
In order to illustrate the proposed framework and algorithm, we consider the problem to find CDF in (11) and the PDF in (12) for a point located in the middle of the side of the square (). The distance vector in (10) and the sorted distance vector are given by
Thus the index vector for this case is given by , which is employed to determine in (17) using the proposed algorithm. Thus the CDF is
(18) 
Substituting (18), and its derivative which is obtained using the expressions in Appendix A, in (12), we obtain the PDF of the distance to the th neighbour, which is shown in Fig. 4 for , and . We can see that the simulation results, which are averaged over 10,000 simulation runs, match perfectly with the analytical results, verifying the proposed framework and algorithm.
VB Special case  reference point at the center of the polygon
Consider the special case that the reference point is located at the center of the polygon, i.e., at the origin . All of the sides and also all of the vertices are equidistant from the center of the polygon and the rotation operator does not affect the point located at the origin. This implies that , , and for . By employing these relations and the proposed algorithm, we obtain the CDF expression for the following three possible ranges
(19) 
VC Special case  reference point at the vertex of the polygon
Consider the special case when the arbitrary point is located at one of the vertex of the polygon. Let the point be located at , that is . From the vertex , the sides , and the vertices , are all equidistant for , where denotes integer floor function. Hence, there are possible ranges of the distance. By using the proposed algorithm to determine the overlap area , we obtain the CDF expression for these ranges as
(20) 
which is then used to the evaluate the PDF of the distance to the th neighbour by employing (12). Fig. 5 shows the plot of the PDF of the distance to the farthest neighbour () from the vertex , with nodes distributed inside a gon with area , for and which corresponds to a disk. For a disk, we can easily use the overlap area approach to obtain the CDF as
(21) 
where and denotes the distance of the point from the origin. Note that (21) is similar to [15, eq. (11)] but with different range conditions. Setting and substituting (21) in (12) produces the result for a disk shown in Fig. 5. For the simulation results, we have used the acceptancerejection method [16] to uniformly distribute the points inside the gon and averaged the results over 10,000 simulation runs. Again it can be seen that the simulation results match perfectly with the analytical results.
Vi Conclusions
In this paper, we have derived the exact cumulative density function of the distance between a randomly located node and any arbitrary reference point inside a regular sided polygon. We have used it to obtain the closedform PDF of the Euclidean distance between any arbitrary reference point and its th neighbour node, when nodes are uniformly and independently distributed inside a regular sided polygon. We have provided examples to demonstrate the generality of our proposed framework. Future work can exploit the knowledge of these general distance distributions to model and analyse the wireless network characteristics, such as connectivity [17], interference and outage probability, from the perspective of an arbitrary node located anywhere (i.e. not just the center) in the finite coverage area.
Appendix A Derivatives
By employing the Leibniz integral rule, we can express the derivatives of and , which are required in the evaluation of in (12), as
(22)  
(23) 
Footnotes
 code available at: http://users.cecs.anu.edu.au/~Salman.Durrani/software.html
References
 S. Srinivasa and M. Haenggi, “Distance distributions in finite uniformly random networks: Theory and applications,” IEEE Trans. Veh. Technol., vol. 59, no. 2, pp. 940–949, Feb. 2010.
 D. Moltchanov, “Distribution of distances in random networks,” Ad Hoc Networks, Mar. 2012. [Online]. Available: http://dx.doi.org/10.1016/j.adhoc.2012.02.005
 P. Fan, G. Li, K. Cai, and K. B. Letaief, “On the geometrical characteristic of wireless adhoc networks and its application in network performance analysis,” IEEE Trans. Wireless Commun., vol. 6, no. 4, pp. 1256–1265, Apr. 2007.
 M. Haenggi and R. K. Ganti, Interference in Large Wireless Networks. Now Publishers Inc., 2008.
 J. G. Andrews and S. Webber, Transmission capacity of wireless networks. Now Publishers Inc., 2012.
 F. Fabbri and R. Verdone, “A statistical model for the connectivity of nodes in a multisink wireless sensor network over a bounded region,” in Proc. 14th European Wireless Conference, Jun. 2008.
 M. Haenggi, “On distances in uniformly random networks,” IEEE Trans. Inf. Theory, vol. 51, no. 10, pp. 3584–3586, Oct. 2005.
 D. Torrieri and M. C. Valenti, “The outage probability of a finite ad hoc network in Nakagami fading,” IEEE Trans. Commun., 2012 (to appear). [Online]. Available: http://arxiv.org/abs/1207.2711v1
 G. Mao and B. D. O. Anderson, “Towards a better understanding of largescale network models,” IEEE/ACM Trans. Netw., vol. 20, no. 2, pp. 408–421, Apr. 2012.
 Y. Zhuang and J. Pan, “Random distances associated with equilateral triangles,” ArXiv Technical Report, 2012. [Online]. Available: http://arxiv.org/abs/1207.1511
 A. M. Mathai, An introduction to geometrical probability: distributional aspects with applications. CRC Press, 1999.
 A. Kostin, “Probability distribution of distance between pairs of nearest stations in wireless network,” Electronics Letters, vol. 46, no. 18, pp. 1299–1300, Sep. 2010.
 Y. Zhuang and J. Pan, “Random distances associated with hexagons,” ArXiv Technical Report, 2011. [Online]. Available: http://arxiv.org/abs/1106.2200
 U. Bäsel, “Random chords and point distances in regular polygons,” ArXiv Technical Report, 2012. [Online]. Available: http://arxiv.org/abs/1204.2707
 C. Bettstetter, “On the connectivity of ad hoc networks,” The Computer Journal, vol. 47, no. 4, pp. 432–447, 2004.
 W. L. Martinez and A. R. Martinez, Computational Statistics Handbook with Matlab. Chapman and Hall/CRC, 2001.
 S. Durrani, Z. Khalid, and J. Guo, “A tractable framework for exact probability of node isolation in finite wireless sensor networks,” ArXiv Technical Report, 2012. [Online]. Available: http://arxiv.org/abs/1212.1283