Table Of Content1
Random Distances Associated with Arbitrary
Polygons: An Algorithmic Approach
between Two Random Points
6
1
Fei Tong and Jianping Pan
0
2
n University of Victoria, Victoria, BC, Canada
a
J
1
2
]
G Abstract
C
.
s This report presents a new, algorithmic approach to the distributions of the distance between
c
[ two points distributed uniformly at random in various polygons, based on the extended Kinematic
1
Measure(KM)fromintegralgeometry.WefirstobtainsuchrandomPointDistanceDistributions(PDDs)
v
7
associated with arbitrary triangles (i.e., triangle-PDDs), including the PDD within a triangle, and that
0
4
between two trianglessharing either a commonside or a commonvertex.For each case, we providean
3
0
algorithmic procedure showing the mathematical derivation process, based on which either the closed-
.
2
0 formexpressionsorthealgorithmicresultscanbeobtained.Theobtainedtriangle-PDDscanbeutilized
6
1 for modeling and analyzing the wireless communication networks associated with triangle geometries,
:
v
such as sensor networks with triangle-shaped clusters and triangle-shaped cellular systems with highly
i
X
directional antennas. Furthermore, based on the obtained triangle-PDDs, we then show how to obtain
r
a
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.
Index Terms
Distance distributions; Kinematic Measure; triangles; polygons; ring geometries; wireless commu-
nication networks
2
I. PDD WITHIN A TRIANGLE
A (cid:127) A (cid:127) A
b " c €(cid:127) (cid:127)€ " (cid:127) "
! # ! # (cid:127)€ ! #
C a Bx C (cid:127) Bx C Bx
(i) $ % & % ! (ii) ! % & % ' ( # (iii) ' ( # % & % '
Fig. 1: KM over an arbitrary triangle.
△ABC is an arbitrary triangle with side lengths |CB| = a, |AC| = b, and |AB| = c, internal
angles ∠A = α, ∠B = β, and ∠C = γ, and area ||△ABC|| = S. Without loss of generality
(WLOG), a ≥ b ≥ c, and let side CB be on x-axis, as shown in Fig. 1. For simplicity, we
can have a = 1 and other edges normalized correspondingly. The Probability Density Function
(PDF) of the PDD, denoted as f (d), can be scaled to any size of triangles with a = s by
D
1 d
f = f ( ) , (1)
sD D
s s
where f is the corresponding PDF of the PDD within the triangle with a = s. Such a scaling
sD
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 x-axis, there are three cases in
terms of the range of θ: (i) 0 ≤ θ ≤ γ, (ii) γ ≤ θ ≤ π−β, (iii) π−β ≤ θ ≤ π. We then design
a systematic algorithmic procedure for the numerical integration of the intended PDD, based on
which the corresponding closed-form expression is also derived, as shown below in detail.
Specifically, let θ increase from 0 to π with a fixed small step of δθ (e.g., δθ = π ). For
180
each θ with a set of lines intersecting with the triangle, G is the line which produces the longest
chord of length base. The distance between the two tangents parallel with G, i.e., the support
lines G and G which completely encompass the whole triangle, is p . The distance between
1 2 m
G and G and that between G and G are p and p , respectively. Obviously, p = p +p . With
1 2 1 2 m 1 2
p increasing from 0 to p with a fixed small step δp (e.g., δp = 1 ), we obtain pm chords.
m 1,000 δp
For each chord of length l calculated based on trigonometry, we obtain f (d), based on which
G
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 δp go to 0.
3
Input: Parameters with regard to △ABC in Fig. 1.
Output: PDF: f (d).
D
1: fD(d) = 0;
2: for (θ = 0; θ ≤ π; θ = θ+δθ) do
3: if 0 ≤ θ ≤ γ then
4: p1 = bsin(γ −θ); p2 = asin(θ); base = sbins(inθ+(αβ));
5: else if γ ≤ θ ≤ π −β then
6: p1 = bsin(θ−γ); p2 = csin(θ +β); base = cssiinn((θβ));
7: else if π −β ≤ θ ≤ π then
8: p1 = asin(θ); p2 = −csin(θ+β); base = scins(inθ−(αγ));
9: end if
10: pm = p1 +p2; /∗ width ∗/
11: for (p = 0; p ≤ pm; p = p+δp) do
12: if p ≤ p1 then
13: l = p·base;
p1
14: else
15: l = (pm−p)·base;
p2
16: end if
17: if l ≥ d then
18: fD(d) = fD(d)+ 2d(Sl−2d);
19: end if
20: end for
21: end for
Fig. 2: Algorithmic procedure for obtaining the PDD within an arbitrary triangle.
We investigate the case (i) where 0 ≤ θ ≤ γ first, and show below how to obtain the
corresponding closed-form expression based on the algorithmic procedure shown in Fig. 2.
Specifically, for 0 ≤ p ≤ p , a chord is determined by (θ,p) with length of l = p·base as
1 p1
shown in line 13 of Fig. 2. From l ≥ d (line 18 of Fig. 2), the integration range of p is [d·p1,p ],
base 1
and θ ≤ θi = arcsin bsin(α) − β or θ ≥ θi = π − arcsin bsin(α) − β. Meanwhile, for
1 (cid:16) d (cid:17) 2 (cid:16) d (cid:17)
p ≤ p ≤ p , the length of the determined chord is l = (pm−p)·base. Similarly, from l ≥ d, we
1 m p2
have p ∈ [p ,p − d·p2], and θ ≤ θi or θ ≥ θi. Therefore,
1 m base 1 2
fi γ ≤ π −β
1 2
fi (d) = , (2)
D
fi +fi otherwise
21 22
4
where
Hi 0,θi +Hi 0,θi 0 ≤ θi ≤ γ
1(cid:0) 1(cid:1) 2(cid:0) 1(cid:1) 1
fi = Hi(0,γ)+Hi(0,γ) θi > γ ,
1 1 2 1
0 otherwise
Hi 0,θi +Hi 0,θi 0 ≤ θi ≤ π −β
fi = 1(cid:0) 1(cid:1) 2(cid:0) 1(cid:1) 1 2 ,
21
0 otherwise
Hi θi,γ +Hi θi,γ θi ≤ γ
fi = 1(cid:0) 2 (cid:1) 2(cid:0) 2 (cid:1) 2 ,
22
0 otherwise
Hi(X,Y) = 1 Y p1 2d(l −d) dpdθ , (3)
1 S2 RX Rd·p1 1
base
Hi(X,Y) = 1 Y pm−bda·ps2e 2d(l −d) dpdθ . (4)
2 S2 RX Rp1 2
Similarly, for case (ii), we have
fii(d) = fii +fii , (5)
D 1 2
where
Hii(γ,θii)+Hii(γ,θii) γ ≤ θii ≤ π
1 1 2 1 1 2
fii = ,
1
0 otherwise
Hii(θii,π −β)+Hii(θii,π −β) θii ≤ π −β
1 2 2 2 2
fii = ,
2
0 otherwise
θii = arcsin csin(β) ,
1 (cid:16) d (cid:17)
θii = π −arcsin csin(β) ,
2 (cid:16) d (cid:17)
and for case (iii),
fiii β ≤ π −γ
1 2
fiii(d) = , (6)
D
fiii +fiii otherwise
21 22
5
where
Hiii(π −β,π)+Hiii(π −β,π) θiii < π −β
1 2 1
fiii = Hiii(θiii,π)+Hiii(θiii,π) π −β ≤ θiii ≤ π ,
1 1 1 2 1 1
0 otherwise
Hiii(π −β,θiii)+Hiii(π −β,θiii) π −β ≤ θiii ≤ π +γ
1 2 2 2 2 2
fiii = ,
21
0 otherwise
Hiii(θiii,π)+Hiii(θiii,π) θiii ≤ π
1 1 2 1 1
fiii = ,
22
0 otherwise
θiii = π −arcsin(csin(α))+γ,
1 d
θiii = arcsin(csin(α))+γ.
2 d
Finally, the PDF of the PDD within an arbitrary triangle is
f (d) = fi (d)+fii(d)+fiii(d) . (7)
D D D D
Similarto Hi and Hi, Hii and Hiii can be calculated using(3), and Hii and Hiii can be calculated
1 2 1 1 2 2
using (4), but with different p , p and base for different cases (see line 3–9 of Fig. 2). Hi, Hi,
1 2 1 2
Hii, Hii, Hiii, and Hiii in (7) are
1 2 1 2
Hi(X,Y) = hi(Y)−hi(X),Hi(X,Y) = hi(Y)−hi(X),
1 1 1 2 2 2
Hii(X,Y) = hii(Y)−hii(X),Hii(X,Y) = hii(Y)−hii(X),
1 1 1 2 2 2
Hiii(X,Y) = hiii(Y)−hiii(X),Hiii(X,Y) = hiii(Y)−hiii(X) ,
1 1 1 2 2 2
6
where
hi(θ) = d (d2 sin(β −γ +2θ)−d(4bsin(α)cos(γ −θ)+
1 2sin(α) 2
dθcos(β +γ))+ b2 ln(−sin(β+θ))(2 sin(β +γ)−
2 cos(γ−θ)
sin(2α+β +γ)+sin(2α−β −γ))+sin2(α)(2b2
(γ −θ)cos(β +γ)−b2ln(tan2(γ −θ)+1)sin(β +γ))) ,
hi(θ) = ad (d2θ cos(β)− d2 sin(β +2θ)+b2θcos(β)sin2(α)
2 bsin(α) 2 4
+2bdsin(α)cos(θ)−b2ln(sin(β +θ))sin(β)sin2(α)) ,
hii(θ) = bd (d2sin(γ −2θ)+2d2θ cos(γ)−4c2sin2(β)
1 4csin(β)
(ln(sin(θ))sin(γ)−θ cos(γ))+8cdsin(β)cos(γ −θ)) ,
hii(θ) = d (2d2θ cos(β)−d2sin(β +2θ)+4c2sin2(β)
2 4sin(β)
(ln(sin(θ))sin(β)+θ cos(β))+8cdcos(β +θ)sin(β)) ,
hiii(θ) = ad (d2sin(β −2θ)+2d2θ cos(β)+8cdsin(α)
1 4csin(α)
cos(θ)+4c2sin2(α)(θ cos(β)+sin(β)ln(−sin(β −θ)))) ,
hiii(θ) = 2d (d2 sin(β −γ +2θ)−
2 sin(α) 8
θ cos(β +γ)(2c2sin2(α)+d2)−cdcos(β +θ)sin(α)−
4
c2 ln(sin(γ −θ))sin(β +γ)sin2(α)) .
2
Therefore, the closed-form expression of the PDF of PDD within an arbitrary triangle, i.e., (7),
has been obtained.
Although the obtained closed-form expression looks tedious, note that, for the network per-
formance 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
7
1
Triangle [c]
0.8
Triangle [b]
0.6
F
D Triangle [a]
C
0.4
KM−based
CLD−based
0.2
Existing Result for ET
Simulation
0
0 0.2 0.4 0.6 0.8 1
Distance
Fig. 3: PDDs within arbitrary triangles.
utilized for obtaining PDDs. However, conducting simulations for each specific triangle is very
time-consuming, 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) 50,000 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] 60π, 60π, 60π , [b] 80π, 70π, 30π , and [c]
(cid:0)180 180 180(cid:1) (cid:0)180 180 180(cid:1)
8
a
B
A !2
!6 !3
e
!7
b
d f B
!5
!4 !8 !4
!1 !5 !1 !2 !3
D c C x D C x
(a) convex quadrangle (b) concave quadrangle
Fig. 4: Two triangles sharing a common side form a quadrangle (||△ABD|| = S , and
1
||△BCD|| = S ).
2
130π, 30π, 20π , all of which have the longest side length of 1, which can be scaled to any
(cid:0) 180 180 180(cid:1)
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 PDD-based performance metrics associated with two clusters in ad-hoc 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 closed-form expressions can be derived following the same method as shown
in Section I.
A. Two Triangles Share a Side, Forming a Convex Quadrangle
(cid:3)ABCD is a convex quadrangle formed by two arbitrary triangles, △ABD with |AB| = a
and |AD| = d, and △BCD with |CB| = b and |CD| = c, as shown in Fig. 4(a). |BD| =
e, |AC| = f, ||△ABD|| = S , and ||△BCD|| = S . WLOG, let DC be on the x-axis.
1 2
The relationship between ∠1 and ∠2 and that between ∠3 and ∠4 determine the shape of the
9
! B B ! B
" #
A ! A A
#
!
! # !
‚1-‚2 $ $
!
$
D (i)(cid:127) € (cid:129) €‚1(cid:127)‚2 C D (ii) ‚1(cid:127)‚2 € (cid:129) €‚1 C D (iii) ‚1 €(cid:129) €‚D C
B ! B ! B
A ! A $ ! ! A "
! # % #
"
!
# ! !
$ $
!
D " ‚5 !%
(iv)‚D € (cid:129) € !"‚C C D (v) !"‚C €(cid:129) € !"‚5C D (vi) !"‚5 € (cid:129) € ! C
Fig. 5: KM over the convex quadrangle shown in Fig. 4(a) (∠C = ∠BCD,∠D = ∠ADC).
quadrangle, leading to the following four cases:
[a] : ∠1 ≥ ∠2, ∠3 ≥ ∠4, [b] : ∠1 ≥ ∠2, ∠3 ≤ ∠4,
[c] : ∠1 ≤ ∠2, ∠3 ≥ ∠4, [d] : ∠1 ≤ ∠2, ∠3 ≤ ∠4.
Case [a] is the same as [d] if BA is on x-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 x-axis. For
a given θ, only the lines intersecting with both triangles are considered, i.e., the parallel lines
between G and G for subcase (i) and (iv), those between G and G for (ii) and (iii), and those
1 3 2 3
between G and G for (v) and (vi). For each line, denote the length of the segment in △ABD
1 4
as l , and that in △BCD as l (l = 0 in this case). The distances between G and G , G and
1 3 2 1 2 2
G , and G and G are p , p , and p , respectively. The complete derivation process is shown
3 3 4 1 2 3
in Fig. 6. Figure 7 shows a close match with the simulation results, given the two triangles,
(∠A = 120π,∠4 = 35π,∠2 = 25π) and (∠C = 80π,∠1 = ∠3 = 50π) as an example, as shown
180 180 180 180 180
in Fig. 4(a).
10
Input: Parameters with regard to the convex quadrangle in Fig. 4(a).
Output: PDF: f (d).
D
1: fD(d) = 0;
2: for (θ = 0; θ ≤ π; θ = θ+δθ) do
3: if θ ∈ (i) or (iv) then
4: pm = p1 +p2;
5: else if θ ∈ (ii) or (iii) then
6: pm = p2;
7: else if θ ∈ (v) or (vi) then
8: pm = p1 +p2 +p3;
9: end if
10: for (p = 0; p ≤ pm; p = p+δp) do
11: Calculate l1 and l3 for the line G(θ,p) according to trigonometry;
12: llow = l1; lup = l3; /* l1 ≤ l3 */
13: if llow > lup then
14: llow = l3; lup = l1; /* l3 < l1 */
15: end if
16: if 0 ≤ d ≤ llow then
17: fD(d) = fD(d)+ S21·dS22;
18: else if d ≤ lup then
19: fD(d) = fD(d)+ 2·Sd1·lSlo2w;
20: else if d ≤ l1 +l3 then
21: fD(d) = fD(d)+ 2·d·(Sl11+Sl23−d);
22: end if
23: end for
24: end for
Fig. 6: Algorithmic procedure for the PDD between two triangles sharing a common side and
forming a convex quadrangle.
B. 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 x-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 △ABD is l and that in △BCD is l .
1 3
The length of the segment between the above two is l . Note that l = 0 when the line
2 2
intersects with DB. The distances between G and G , and G and G are p and p , respectively.
1 2 2 3 1 2
Figure9 summarizesthederivationprocess.Forverification, thefollowingtwo trianglesare used: