We present a simple algorithm for computing the so-called \emph{Beer-index} of a polygon $P$ in $O(n^2)$ time, where $n$ is the number of corners. The polygon $P$ may have holes. The Beer-index is the probability that two points chosen independently and uniformly at random in $P$ can see each other. Given a finite set $M$ of $m$ points in a simple polygon $P$, we also show how the number of pairs in $M$ that see each other can be computed in $O(n\log n + m\log n\log (nm))$ time, which is optimal up to logarithmic factors. We likewise study the problem of computing the expected geodesic distance between two points chosen independently and uniformly at random in a simple polygon $P$. We show how the expected $L_1$-distance can be computed in optimal $O(n)$ time by a conceptually very simple algorithm. We then describe an algorithm that outputs a closed-form expression for the expected $L_2$-distance in $O(n^2)$ time.
翻译:我们提出了一个简单的算法,用于计算以美元(n°2)计的多边形美元($),其中美元是角数。多边形美元可能存在孔。啤酒指数是以美元随机独立和统一选择的两点($P)的概率。如果在一个简单的多边形美元中设定了以美元为单位的限定值,以美元计点,那么我们还展示了如何用美元(n)以美元为单位,用美元($)计算互相看对方的对子数量,而美元(n)是圆点数的最佳计算方法。我们同样研究两个独立和统一地随机选择的两点之间预期的大地测量距离($P美元)的概率。我们展示了如何用一个概念性非常简单的算法,以美元(n)计算出预期的美元($)时间($O)的封闭式表达法。