2 \page barycoords Barycentric coordinates algorithm
4 Computation of barycentric coordinates is used to fill interpolation
5 matrix in case of P1 an P1d types of interpolation. Computation of
6 barycentric coordinates consists in finding weights of vertices
7 bearing values within the cell. The cell is triangle in 2D space and
8 tetrahedron in 3D space.
10 Input of the algorithm includes
11 - coordinates of cell vertices (p1...pn),
12 - coordinates of a barycentre of cells intersection (b),
13 <br>where n is number of vertices which is either 3 or 4.
15 Purpose is to find coefficients a1...an so that
16 - (a1*p1+...+an*pn)=b and
19 Combining the last two expressions we get an equation in matrix form
22 - a is a vector of coefficients a1...an
23 - b is a vector of cartesian coordinates of barycentre
24 - T is a matrix expressed via cartesian coordinates of vertices as
31 | z1-z4 z2-z4 z3-z4 |</pre>
33 In 2D case solution is found by inversing T which is trivial: a = T^(-1) * ( b - pn )
35 In 3D case we use Gaussian elimination algorithm. First we use elementary
36 row operations to transform T into upper triangular form and
37 then perform back substitution to find coeficients a.