rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
aff_trafo_orig2ref.m
1 function [C, G] = aff_trafo_orig2ref(x0, y0, varargin)
2 %function [C, G] = aff_trafo_orig2ref(x0, y0, varargin)
3 % function giving the coefficients for the affine transformation
4 % from original triangle to the reference one,
5 %
6 % ``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``
7 %
8 % @verbatim
9 % triangle: /| (x0(3),y0(3)) (0,1) |\
10 % / | ---T---> | \
11 % (x0(1),y0(1)) /__| (x0(2),y0(2)) (0,0) |__\ (1,0)
12 % @endverbatim
13 %
14 % @deprecated I guess, that this function is deprecated and
15 % aff_trafo_glob2loc() should be used instead...
16 %
17 % function giving c1, c2, g11, g12, g21, g22
18 % so: C=[c1; c2] and G=[g11, g12; g21, g22]
19 
20 
21 % Oliver Zeeb, 01.02.11
22 
23 x1 = 0;
24 y1 = 0;
25 x2 = 1;
26 y2 = 0;
27 x3 = 0;
28 y3 = 1;
29 
30 ref_coord = [x1; y1; x2; y2; x3; y3];
31 
32 B_aff = [1, 0, x0(1), y0(1), 0, 0; ...
33  0, 1, 0, 0, x0(1), y0(1); ...
34  1, 0, x0(2), y0(2), 0, 0; ...
35  0, 1, 0, 0, x0(2), y0(2); ...
36  1, 0, x0(3), y0(3), 0, 0; ...
37  0, 1, 0, 0, x0(3), y0(3)];
38 
39 coef_vec = B_aff \ ref_coord;
40 
41 C = [coef_vec(1); coef_vec(2)];
42 G = [coef_vec(3), coef_vec(4); coef_vec(5), coef_vec(6)];
43 % c1 = coef_vec(1);
44 % c2 = coef_vec(2);
45 % g11 = coef_vec(3);
46 % g12 = coef_vec(4);
47 % g21 = coef_vec(5);
48 % g22 = coef_vec(6);