Home > bioelectromagnetism > mesh_emse2mat3d.m

mesh_emse2mat3d

PURPOSE ^

mesh_emse2mat3d - Convert emse vertex/patches to matlab vertices/faces

SYNOPSIS ^

function [faces,vertices] = mesh_emse2mat3d(vertex,patch)

DESCRIPTION ^

 mesh_emse2mat3d - Convert emse vertex/patches to matlab vertices/faces

 Useage: [faces,vertices] = mesh_emse2mat3d(vertex,patch)

           vertex & patch are generated from emse files with
           mesh_emse2matlab (see this file for more help).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [faces,vertices] = mesh_emse2mat3d(vertex,patch)
0002 
0003 % mesh_emse2mat3d - Convert emse vertex/patches to matlab vertices/faces
0004 %
0005 % Useage: [faces,vertices] = mesh_emse2mat3d(vertex,patch)
0006 %
0007 %           vertex & patch are generated from emse files with
0008 %           mesh_emse2matlab (see this file for more help).
0009 %
0010 
0011 % $Revision: 1.1 $ $Date: 2004/11/12 01:32:35 $
0012 
0013 % Licence:  GNU GPL, no implied or express warranties
0014 % History:  12/98 Abbas Kouzani
0015 %           09/01 Darren.Weber_at_radiology.ucsf.edu
0016 %                 - converted to function, rather than script
0017 %
0018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0019 
0020 %S=sprintf('load %s',file);eval(S);
0021 
0022 vertices = zeros(length(vertex),3);
0023 for i=1:length(vertex),
0024     vertices(i,1) = vertex(i).location1;
0025     vertices(i,2) = vertex(i).location2;
0026     vertices(i,3) = vertex(i).location3;
0027 end
0028 
0029 faces = zeros(length(patch),3);
0030 for i=1:length(patch),
0031 
0032     v = patch(i).vertex1;   flag = 0;
0033     for j=1:length(vertex),
0034         if isequal(v, vertex(j).address)
0035             faces(i,1) = j; flag = 1; break;
0036         end
0037     end
0038     if (flag==0) fprintf('...error in patch(%d).vertex1!\n',i); break;end
0039     
0040     v = patch(i).vertex2;   flag = 0;
0041     for j=1:length(vertex),
0042         if isequal(v, vertex(j).address)
0043             faces(i,2) = j; flag = 1; break;
0044         end
0045     end
0046     if (flag==0) fprintf('...error in patch(%d).vertex2!\n',i); break;end
0047     
0048     v = patch(i).vertex3;   flag = 0;
0049     for j=1:length(vertex),
0050         if isequal(v, vertex(j).address)
0051             faces(i,3) = j; flag = 1; break;
0052         end
0053     end
0054     if (flag==0) fprintf('...error in patch(%d).vertex3!\n',i); break;end
0055 end
0056 
0057 %disp('...Saving');
0058 %GET1=input(' Enter output filename: ','s');
0059 %S=sprintf('save %s faces vertices',GET1);
0060 %eval(S);

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003