rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
global2local.m
1 function loc = global2local(grid, elementid, glob)
2 %function loc = global2local(grid, elementid, glob)
3 % function getting a triagrid, an element-ID and a vector of points and
4 % giving a vector of transformed points. The triangle given by elementid is
5 % used for the creation of an affine map to the standard tringle, then this
6 % transformation is used for all the points in glob
7 %
8 % input:
9 % grid: triagrid
10 % elementid: scalar nr of the triangle in triagrid, which defines the affine map
11 % glob: n-by-2-vector of points to be transformed
12 %
13 % output:
14 % loc: n-by-2-vector of the transformed points
15 %
16 % Oliver Zeeb, 02.02.11
17 
18 vertex_id = grid.VI(elementid,:);
19 tria_pts_x = grid.X(vertex_id);
20 tria_pts_y = grid.Y(vertex_id);
21 
22 [C,G] = aff_trafo_glob2loc(tria_pts_x, tria_pts_y);
23 
24 loc = (repmat(C,1,size(glob,1)) + G*glob')';