1 function [C, G] = aff_trafo_loc2glob(x0, y0)
2 %
function [C, G] = aff_trafo_loc2glob(x0, y0)
3 %
function giving the coefficients
for the affine transformation
4 % from reference/local triangle to the original/global one.
6 % In detail,
this implements a transformation of the type
7 % ``T^{-1}_{i,aff}(x;\mu) = C^{-1}_{i,aff}(\mu) + \sum_{j=1,2} G^{k,-1}_{ij}(\mu) x_j \qquad i=1,2``
9 % The transformation is calculated
for the standard triangle:
12 % triangle: (0,1) |\ /| (x0(3),y0(3))
14 % (0,0) |__\ (1,0) (x0(1),y0(1)) /__| (x0(2),y0(2))
18 % x0: vector of size
'3 x 1' holding x values of the original/global triangle
19 % y0: vector of size
'3 x 1' holding y values of the original/global triangle
22 % C: matrix of size
'2 x 1' with entries
'C=[c1; c2]'
23 % G: matrix of size
'2 x 2' with entries
'G=[g11, g12; g21, g22]'
25 % See also aff_trafo_glob2loc() which gives the transformation in the other
26 % direction (global to local)
28 % Oliver Zeeb, 01.02.11
41 %matrices
for transformation:
42 B_aff = [1, 0, x1, y1, 0, 0; ...
43 0, 1, 0, 0, x1, y1; ...
44 1, 0, x2, y2, 0, 0; ...
45 0, 1, 0, 0, x2, y2; ...
46 1, 0, x3, y3, 0, 0; ...
49 V_aff = [x0(1); y0(1); x0(2); y0(2); x0(3); y0(3)];
51 coef_vec = B_aff \ V_aff;
53 C = [coef_vec(1); coef_vec(2)];
54 G = [coef_vec(3), coef_vec(4); coef_vec(5), coef_vec(6)];