THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/10/2005 at 07:13, xxxxxxxx wrote:
Cinema 4D Version: 9.5
Platform: Windows ; Mac ;
Language(s) : C++ ;
does anybody know how to compute a point in a triangle from its barycentric coords (that I got from the Ray collider engine)?
Or any links to that topic?
On 20/10/2005 at 07:55, xxxxxxxx wrote:
ok, got it. It´s just a weighted sum of the coords.
On 22/10/2005 at 16:02, xxxxxxxx wrote:
can you explain how to do the weighted sum?
On 22/10/2005 at 16:29, xxxxxxxx wrote:
Take all of the x-coordinate values, sum together, and divide by the number of x values (three in the case of a triangle). Do the same for the y and z coordinate values.
T.x = (A.x + B.x + C.x) * 0.3333333;
T.y = (A.y + B.y + C.y) * 0.3333333;
T.z = (A.z + B.z + C.z) * 0.3333333;
By weighted, I think he means 'average'. If you were going to weight the sum, you might multiply each value by some weighting value. If this is the case, then it becomes:
T.x = ((A.x*wA)+(B.x*wB)+(C.x*wC))*0.3333333;
where wA/wB/wC are weights applied to each point's coordinate component.
On 22/10/2005 at 16:33, xxxxxxxx wrote:
I did the same things to get random coordinate in the triangle