Home > vbmeg > external > iso2mesh > sample > demo_insert_nodes.m

demo_insert_nodes

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   demo script to insert new nodes to a tetrahedral mesh
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0002 %   demo script to insert new nodes to a tetrahedral mesh
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 
0005 load rat_head.mat
0006 
0007 [node,elem,face]=vol2mesh(volimage>0.05,1:size(volimage,1),1:size(volimage,2),...
0008                            1:size(volimage,3),2,2,1);
0009 
0010 plotmesh(node,face);
0011 
0012 dt=pi/10;
0013 r=3;
0014 x0=30;
0015 y0=28;
0016 theta=dt:dt:2*pi;
0017 x=x0+r*cos(theta);
0018 y=y0+r*sin(theta);
0019 
0020 p0=[x;y;ones(1,length(theta))*50]';
0021 v0=[0,0,-1];
0022 
0023 [t,u,v,idx,xnode]=raysurf(p0,v0,node,face(:,1:3));
0024 
0025 hold on
0026 plotmesh(p0,'r+');
0027 
0028 goodpt=find(~isnan(xnode(:,1)) & ~isnan(xnode(:,2)) & ~isnan(xnode(:,3)));
0029 [newnode,newelem,newface]=meshrefine(node,elem,face,xnode(goodpt,:));
0030 
0031 figure
0032 plotmesh(newnode,newface);
0033 hold on
0034 plotmesh(p0,'r+');
0035 plotmesh(xnode,'r.')

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005