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