样品随机点在三角形 [英] sample random point in triangle

查看:219
本文介绍了样品随机点在三角形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设你有一个任意三角形顶点 A B C 本文(4.2节)说,你可以生成一个随机点, P ,均匀地从内部三角农行由顶点以下凸组合:

Suppose you have an arbitrary triangle with vertices A, B, and C. This paper (section 4.2) says that you can generate a random point, P, uniformly from within triangle ABC by the following convex combination of the vertices:

P = (1 - sqrt(r1)) * A + (sqrt(r1) * (1 - r2)) * B + (sqrt(r1) * r2) * C

其中, R1 R2 均匀地从绘制[0,1] 开方是平方根函数。

where r1 and r2 are uniformly drawn from [0, 1], and sqrt is the square root function.

你怎么证明那个被均匀分布的采样点的内三角农行

How do you justify that the sampled points that are uniformly distributed within triangle ABC?

修改

正如在评论的mathoverflow问题图形宝石讨论这个算法

推荐答案

您已经从单位平方到您的三角形的地图P(R1,R2)。选择R1和R2一致给出了一个随机点在单位正方形。在三角形的图像被根据地图磷,其原来是一个恒定的雅可比行列式分布。因此该图像分布也是均匀的。

You have a map P(r1,r2) from the unit square to your triangle. Choosing r1 and r2 uniformly gives a random point in the unit square. The image in the triangle is distributed according to the Jacobian determinant of the map P, which turns out to be a constant. Therefore the image distribution is also uniform.

其实,要验证这一点,你只需要检查它的一个三不共线的点A,B,C。仿射线性映射具有恒定的雅可比,所以你可以将其中的一个移动的任意三到这个标准的位置,而不会影响分配。

Actually, to verify this you only need to check it for one triple of non-collinear points A,B,C. Affine linear maps have constant Jacobian so you can apply one of these to move an arbitrary triple into this standard position without affecting the distribution.

最后,关于词为什么:考虑为填补由线段平行于BC边三角形。在公式P时,变量R1选择该段点会趴在,而R2决定了沿该段将。对于均匀性,在给定段的所有点应一视同仁(因此线性关系R2)。但对于R 1,因为一些段比其它短,我们需要以有利于长的段,以便实现均匀的分布。式中的开方(R1)占此

Finally, a word about "why": Consider the triangle as filled out by line segments parallel to the BC side. In the formula for P, the variable r1 selects which segment the point will lie on, while r2 determines where along the segment it will be. For uniformity, all points on a given segment should be treated equally (hence linear in r2). But for r1, since some segments are shorter than others, we need to favor the long segments in order to attain a uniform distribution. The sqrt(r1) in the formula accounts for this.

这篇关于样品随机点在三角形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆