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
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
?
EDIT
As pointed out in a comment on the mathoverflow question, Graphical Gems discusses this algorithm.