Salome HOME
b45c2a60d5b6283ccb5d37cb98d77c44345ef63c
[modules/med.git] / doc / doxygen / input / interpolation / barycoords.dox
1 /*!
2 \page barycoords Barycentric coordinates algorithm
3
4 Computation of barycentric coordinates is used to fill interpolation
5 matrix in case of P1 and P1d types of interpolation. Computation of
6 barycentric coordinates consists in finding weights of vertices
7 bearing values within the cell. The cell is triangular in 2D space and
8 tetrahedral in 3D space.
9
10 Input of the algorithm include:
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.
14
15 Purpose is to find coefficients a1...an so that
16 - (a1*p1+...+an*pn)=b and
17 - (a1+...+an)=1.0
18
19 Combining the last two expressions we get an equation in matrix form
20 a * T = ( b - pn )
21 where
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
25 <br>in 2D case <pre>
26 | x1-x3 x2-x3 |
27 | y1-y3 y2-y3 |</pre>
28 in 3D case <pre>
29 | x1-x4 x2-x4 x3-x4 |
30 | y1-y4 y2-y4 y3-y4 |
31 | z1-z4 z2-z4 z3-z4 |</pre>
32
33 In 2D case solution is found by inverting T which is trivial: a = T^(-1) * ( b - pn )
34
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 coefficients a.
38
39 */