edge_refined_node_mapper

PURPOSE ^

EDGE_REFINED_NODE_MAPPER:

SYNOPSIS ^

function [index_vtx] = edge_refined_node_mapper(mdl_coarse, mdl_dense);

DESCRIPTION ^

 EDGE_REFINED_NODE_MAPPER: 
      maps a dense mesh verticies array onto a more coarse mesh verticies
      array.  The closest vertex on the dense mesh to the objective vertex on
      the coarse mesh is found.

 Usage:
  [index_vtx] = edge_refined_node_mapper(mdl_coarse, mdl_dense);

 mdl_coarse  = fwd_model of coarse mesh
 mdl_dense   = fwd_model of dense mesh

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [index_vtx] = edge_refined_node_mapper(mdl_coarse, mdl_dense);
0002 % EDGE_REFINED_NODE_MAPPER:
0003 %      maps a dense mesh verticies array onto a more coarse mesh verticies
0004 %      array.  The closest vertex on the dense mesh to the objective vertex on
0005 %      the coarse mesh is found.
0006 %
0007 % Usage:
0008 %  [index_vtx] = edge_refined_node_mapper(mdl_coarse, mdl_dense);
0009 %
0010 % mdl_coarse  = fwd_model of coarse mesh
0011 % mdl_dense   = fwd_model of dense mesh
0012 
0013 index_vtx = eidors_obj('get-cache', mdl_dense, 'index_vtx', mdl_coarse);
0014 if ~isempty(index_vtx)
0015     eidors_msg('edge_refined_node_mapper: using cached value', 2);
0016     return
0017 end
0018 
0019 vtx_dense  = mdl_dense.nodes;
0020 simp_dense = mdl_dense.elems;
0021 vtx_coarse  = mdl_coarse.nodes;
0022 simp_coarse = mdl_coarse.elems;
0023 
0024 index=zeros(size(vtx_coarse,1),2);
0025 
0026 
0027 % Down to business ...
0028 
0029 h = waitbar(0,'Calculating Verticies Map');
0030 
0031 for ic=1:size(vtx_coarse,1);   % for all coarse verticies
0032     
0033     waitbar(ic/size(vtx_coarse,1))
0034 
0035     dx=vtx_dense(:,1)-vtx_coarse(ic,1);   % find the x co-ord difference
0036     dy=vtx_dense(:,2)-vtx_coarse(ic,2);   % find the y co-ord difference
0037     dz=vtx_dense(:,3)-vtx_coarse(ic,3);   % find the z co-ord difference
0038     
0039     % distance between points for each dense vertex and the ic'th coarse vertex
0040     dist=sqrt((dx.^2)+(dy.^2)+(dz.^2));
0041     
0042     [m,index(ic,1)]=min(dist);   % index out the minimum distance from the dense mesh to the ic'th vertex
0043     
0044     index(ic,2)=m;   % write the actual minimum distance (as a quality control procedure)
0045     
0046 end
0047 
0048 close(h)
0049 
0050 index_vtx=index;
0051 
0052 % Cache the restult - it depends on both dense and coarse mdl
0053 eidors_obj('set-cache', mdl_dense, 'index_vtx', index_vtx, mdl_coarse);
0054 eidors_msg('edge_refined_node_mapper: setting cached value', 2);
0055 
0056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0057 % This is part of the EIDORS suite.
0058 % Copyright (c) D.R Stephenson 2004
0059 % Copying permitted under terms of GNU GPL
0060 % See enclosed file gpl.html for details.
0061 % EIDORS 3D version XXX
0062 % MATLAB Version 6.5.0.180913a (R13)
0063 % MATLAB License Number: 1560
0064 % Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 1)
0065 % Java VM Version: Java 1.3.1_01 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
0066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Generated on Tue 09-Aug-2011 11:38:31 by m2html © 2005