rbmatlab 0.10.01
grid/@triagrid/global2local.m
00001 function loc = global2local(grid, elementid, glob)
00002 %function loc = global2local(grid, elementid, glob)
00003 % function getting a triagrid, an element-ID and a vector of points and
00004 % giving a vector of transformed points. The triangle given by elementid is
00005 % used for the creation of an affine map to the standard tringle, then this
00006 % transformation is used for all the points in glob
00007 %
00008 % input:
00009 % grid:       triagrid
00010 % elementid:  scalar nr of the triangle in triagrid, which defines the affine map
00011 % glob:       n-by-2-vector of points to be transformed
00012 %
00013 % output:
00014 % loc:        n-by-2-vector of the transformed points
00015 %
00016 % Oliver Zeeb, 02.02.11
00017 
00018 vertex_id = grid.VI(elementid,:);
00019 tria_pts_x = grid.X(vertex_id);
00020 tria_pts_y = grid.Y(vertex_id);
00021 
00022 [C,G] = aff_trafo_glob2loc(tria_pts_x, tria_pts_y);
00023 
00024 loc = (repmat(C,1,size(glob,1)) + G*glob')';
All Classes Namespaces Files Functions Variables