How can I map the coordinate of a copied triangle in a parallelogram to the original triangle? I've been reading the following article...
https://hbfs.wordpress.com/2010/10/05/random-points-in-a-triangle-generating-random-sequences-ii/
Which basically talks about how to generate a random point INSIDE of a triangle by:


*

*Making a copy of the triangle

*Transforming the copied triangle and joining the original triangle with the copied triangle to form a parallelogram.

*Generating a random point within the parallelogram.

*If the point is INSIDE of the COPIED triangle, map the point to the corresponding point in the ORIGINAL triangle.


I am currently on step 4 and I'm not understanding how exactly to transform the point into a point in the corresponding ORIGINAL triangle.
Could anyone help clarify how to accomplish this and what equation/formula is needed?
 A: Suppose one point of the triangle is at the origin and the other two points have position vectors $\mathbf v_1$ and $\mathbf v_2$. Points are generated in the parallelogram as follows:
$$\mathbf x=A\mathbf v_1+B\mathbf v_2$$
where $A$ and $B$ are independent and uniformly distributed on $[0,1]$.
$\mathbf x$ will lie in the original triangle if and only if $A+B\le1$. After generating the two random variables, if this test fails the random variables are transformed:
$$A\to1-A,B\to1-B$$
This transformation maps the copied triangle to the original triangle. Having done this conditional transformation, calculating $\mathbf x$ is guaranteed to yield a point uniformly distributed over the desired triangle.
A: Basically, do the same thing you did to create the parallelogram in the first place: reflect the point in the center of the parallelogram, which is the midpoint of the common edge of the two triangles. Referring back to the second diagram in my answer to your previous question, let $P$ be any point on the paralellogram and $M$ the midpoint of a diagonal (it doesn’t matter which one since they bisect each other). Then the point $P'=M-(P-M)$ is the corresponding point on the opposite half of the paralellogram. Notice that this is exactly the same formula that you used to compute the fourth vertex of the paralellogram from the vertices of the original triangle.
