Random Distances Associated with Arbitrary Polygons: An Algorithmic Approach
between Two Random Points
Abstract
This report presents a new, algorithmic approach to the distributions of the distance between two points distributed uniformly at random in various polygons, based on the extended Kinematic Measure (KM) from integral geometry. We first obtain such random Point Distance Distributions (PDDs) associated with arbitrary triangles (i.e., trianglePDDs), including the PDD within a triangle, and that between two triangles sharing either a common side or a common vertex. For each case, we provide an algorithmic procedure showing the mathematical derivation process, based on which either the closedform expressions or the algorithmic results can be obtained. The obtained trianglePDDs can be utilized for modeling and analyzing the wireless communication networks associated with triangle geometries, such as sensor networks with triangleshaped clusters and triangleshaped cellular systems with highly directional antennas. Furthermore, based on the obtained trianglePDDs, we then show how to obtain the PDDs associated with arbitrary polygons through the decomposition and recursion approach, since any polygons can be triangulated, and any geometry shapes can be approximated by polygons with a needed precision. Finally, we give the PDDs associated with ring geometries. The results shown in this report can enrich and expand the theory and application of the probabilistic distance models for the analysis of wireless communication networks.
Distance distributions; Kinematic Measure; triangles; polygons; ring geometries; wireless communication networks
I PDD within a Triangle
is an arbitrary triangle with side lengths , , and , internal angles , , and , and area . Without loss of generality (WLOG), , and let side be on axis, as shown in Fig. 1. For simplicity, we can have and other edges normalized correspondingly. The Probability Density Function (PDF) of the PDD, denoted as , can be scaled to any size of triangles with by
(1) 
where is the corresponding PDF of the PDD within the triangle with . Such a scaling is applicable to any polygons. When calculating the length of the chord produced by a line intersecting with the triangle with orientation with regard to axis, there are three cases in terms of the range of : (i) , (ii) , (iii) . We then design a systematic algorithmic procedure for the numerical integration of the intended PDD, based on which the corresponding closedform expression is also derived, as shown below in detail.
Specifically, let increase from to with a fixed small step of (e.g., ). For each with a set of lines intersecting with the triangle, is the line which produces the longest chord of length . The distance between the two tangents parallel with , i.e., the support lines and which completely encompass the whole triangle, is . The distance between and and that between and are and , respectively. Obviously, . With increasing from 0 to with a fixed small step (e.g., ), we obtain chords. For each chord of length calculated based on trigonometry, we obtain , based on which the PDF of the PDD can be calculated. The derivation is summarized in Fig. 2, providing the regularity to help obtain the PDF symbolically as and go to .
We investigate the case (i) where first, and show below how to obtain the corresponding closedform expression based on the algorithmic procedure shown in Fig. 2. Specifically, for , a chord is determined by () with length of as shown in line 13 of Fig. 2. From (line 18 of Fig. 2), the integration range of is , and or . Meanwhile, for , the length of the determined chord is . Similarly, from , we have , and or . Therefore,
(2) 
where
(3)  
(4) 
Similarly, for case (ii), we have
(5) 
where
and for case (iii),
(6) 
where
Finally, the PDF of the PDD within an arbitrary triangle is
(7) 
Similar to and , and can be calculated using (3), and and can be calculated using (4), but with different , and for different cases (see line 3–9 of Fig. 2). , , , , , and in (7) are
where
Therefore, the closedform expression of the PDF of PDD within an arbitrary triangle, i.e., (7), has been obtained.
Although the obtained closedform expression looks tedious, note that, for the network performance analysis, we do not use the symbolic expression of (7) directly but the numerical PDF result calculated promptly by (7) providing the necessary parameters (e.g., two edges and one angle, or two angles and one edge) of an arbitrary triangle. Simulations can also be utilized for obtaining PDDs. However, conducting simulations for each specific triangle is very timeconsuming, and requires a large number of runs to obtain statistically significant results. Moreover, by simulations, only the empirical Cumulative Distribution Function (CDF) of nodal distances can be obtained, while the accurate PDF is also indispensable to the modeling and analysis of wireless communication networks.
The obtained results are verified in comparison with simulation and the approach in [2] based on Chord Length Distribution (CLD). The simulation is conducted in Matlab as below (the following simulations are all conducted in a similar way):
 (1)

Generate a point uniformly at random within a triangle.
 (2)

Generate another point uniformly at random within the triangle.
 (3)

Compute the Euclidean distance between these two points and append the obtained distance to a matrix.
 (4)

Repeat steps (1)–(3) times (the more repeats, the more accurate the result). Then use the Matlab function “ecdf” with the matrix as its parameter, we can obtain the empirical CDF of the PDD within the triangle.
For simplicity, only numerical CDFs obtained by integrating the corresponding PDFs are shown here and hereafter. Three triangles are selected: [a] , [b] , and [c] , all of which have the longest side length of 1, which can be scaled to any nonzero size as introduced in (1). For the first triangle, i.e., an equilateral triangle (ET), the result is also compared with that obtained in [4], which is only applicable for ET. Figure 3 shows a close match between the obtained results based on KM and the simulation results.
Ii PDD between Two Triangles
Our approach can also be utilized to obtain the PDD between two disjoint geometries, with which the PDDbased performance metrics associated with two clusters in adhoc networks or two cells in cellular systems can be quantified. In this section, we show how to obtain the PDDs between two triangles sharing either a common side or a vertex. For the former, the two triangles can form either a convex or concave quadrangle, as shown in Fig. 4(a) and 4(b), respectively. For simplicity, hereafter, only the algorithmic procedure showing the derivation process is provided, based on which the closedform expressions can be derived following the same method as shown in Section I.
Iia Two Triangles Share a Side, Forming a Convex Quadrangle
is a convex quadrangle formed by two arbitrary triangles, with and , and with and , as shown in Fig. 4(a). , , , and . WLOG, let be on the axis. The relationship between and and that between and determine the shape of the quadrangle, leading to the following four cases:
Case [a] is the same as [d] if is on axis after rotating the quadrangle. Similarly, case [b] and [c] are essentially the same. Different cases correspond to different ranges of the orientation angle . Below, we will use case [a] to show how to obtain the PDD between the two triangles.
As shown in Fig. 5, for the convenience of calculation based on trigonometry, there are six subcases for case [a] in terms of the range of the line orientation with regard to axis. For a given , only the lines intersecting with both triangles are considered, i.e., the parallel lines between and for subcase (i) and (iv), those between and for (ii) and (iii), and those between and for (v) and (vi). For each line, denote the length of the segment in as , and that in as ( in this case). The distances between and , and , and and are , , and , respectively. The complete derivation process is shown in Fig. 6. Figure 7 shows a close match with the simulation results, given the two triangles, and as an example, as shown in Fig. 4(a).
IiB Two Triangles Share a Side, Forming a Concave Quadrangle
A concave quadrangle formed by two triangles is shown in Fig. 4(b). Similarly, for the convenience of calculation by using trigonometry, the line orientation with regard to axis can be categorized into six cases, as shown in Fig. 8. Given , for each line intersecting with both triangles, the length of the segment in is and that in is . The length of the segment between the above two is . Note that when the line intersects with . The distances between and , and and are and , respectively. Figure 9 summarizes the derivation process. For verification, the following two triangles are used: and . The analytical results in close match with the simulation results are shown in Fig. 7.
IiC Two Triangles Share a Vertex
For the simplicity of dividing the range of the line orientation, two special cases are employed for demonstration: [a] two triangles sharing a common vertex are within a regular pentagon, as shown in Fig. 10(a), and [b] two triangles sharing a common vertex are within a regular hexagon, as shown in Fig. 10(b). Note that our approach is not limited to regular polygons, but also applies to other cases associated with arbitrary triangles.
For case [a], the two triangles are labeled by R1 and R3, respectively. With on axis, the line orientation with regard to axis falls into five subcases: (i) ; (ii) ; (iii) ; (iv) ; (v) . Note that the lines with in (ii) will not be considered, since none of them intersects with both of the triangles. The algorithmic procedure shown in Fig. 9 can still obtain the PDD between the two triangles, only with the difference in calculating (line 3–7), , , and (line 9). Figure 11(a) shows the comparison in a close match with simulation. For case [b] where the regular hexagon is triangulated as shown in Fig. 10(b), the two triangles are either R1 and R3, R1 and R4, or R2 and R4. According to the symmetry of the regular hexagon, the PDD between R1 and R3 is identical with that between R2 and R4. With the same method, the results are shown in Fig. 11(b).
Iii PDDs for Arbitrary Polygons
With the trianglePDDs obtained above, the PDD associated with arbitrary polygons can be obtained through a Decomposition and Recursion (D&R) approach, since any polygon can be triangulated. Therefore, the PDDbased performance metrics of wireless networks associated with arbitrary polygons can be quantified accurately.
Taking the regular pentagon with the triangulation shown as in Fig. 10(a) for example, through D&R, the CDF of the PDD within the pentagon is given by a probabilistic sum,
where is the area of the pentagon. The comparison with simulation is shown in Fig. 12(a). Likewise, the CDF of the PDD within the regular hexagon of area , with the polygon triangulation shown as in Fig. 10(b), is
The comparison with the existing result obtained in [3] and simulation in a close match is shown in Fig. 12(b).
Iv PDDs for Ring Geometries
In this section, we show the PDDs associated with ring geometries by applying the D&R approach. For ease of presentation, we use two examples, one is a square ring as shown in Fig. 13(a), and the other is a hexagon ring as shown in Fig. 13(b).
For the square ring, we consider a unit square (i.e., the side length of the square is ) labeled by , with a smaller square (its side length is ) located in the center and labeled by . The ring area in grey is labeled by . We use to denote the CDF of the random distances within , and the CDF of the random distances between and . and can be obtained with the developed approach directly. Then with a weighted probabilistic sum,
(8) 
based on which , , and can be obtained. The obtained CDFs of the PDDs of interest are shown in Fig. 14(a). Similarly, the CDFs of the PDDs associated with the hexagon ring are shown in Fig. 14(b), where the radius of the circle in the center of the unit hexagon (its side length is ) is . Note that if there are nodes deployed in and but with different node densities from each other, the above weighted probabilistic sum is still applicable with different weights due to the node density differences, which shows the way of handling nonuniform node distributions.
V Conclusions
In this report, we first applied the proposed algorithmic approach to obtain the random PDDs associated with arbitrary triangles (trianglePDDs). Since any polygons can be triangulated, we then used the decomposition and recursion approach for arbitrary polygons based on trianglePDDs. Finally, the PDDs associated with ring geometries were also shown. The algorithmic procedures were provided to show the mathematical derivation process, based on which either the closedform expressions or the algorithmic results can be obtained. Together with [1], and the decomposition and recursion approach, all random distances associated with random polygons, regardless between two random points or with an arbitrary reference point, can be obtained, so for any arbitrary geometry shapes with any needed approximation precision.
Acknowledgment
This work is supported in part by the NSERC, CFI and BCKDF. We also thank Dr. Lin Cai for her constructive suggestions and encouragement, and Drs. Lei Zheng and Maryam Ahmadi for their comments and suggestions to this work.
References
 [1] M. Ahmadi and J. Pan. Random distances associated with arbitrary triangles: a recursive approach with an arbitrary reference point. UVicPanLabTR1401, 2014. [Online] http://hdl.handle.net/1828/5134.
 [2] F. Tong, M. Ahmadi, and J. Pan. Random distances associated with arbitrary triangles: a systematic approach between two random points. arXiv:1312.2498, 2013.
 [3] Y. Zhuang and J. Pan. Random distances associated with hexagons. arXiv:1106.2200, 2011.
 [4] Y. Zhuang and J. Pan. Random distances associated with equilateral triangles. arXiv:1207.1511, 2012.