clear;clc;
tb1 = [-1 -1 5]; tb2 = [21 16 11]; % Tissue Slab "Box" (2 corner nodes)
bb1 = [0 0 0]; bb2 = [20 15 10]; % Bounding Box (2 corner nodes)
detpos = [11.27, 7.5, 0]; % Detector Position
radius = 0.8;
% mesh the tissue slab (slightly bigger, so it overlaps):
[node_box,faces_box] = meshabox(tb1,tb2,0.1,1);
% mesh the sphere:
[node_hs,faces_hs] = meshasphere(detpos,0.8,1,1);
% mesh the bounding box:
[node_bb,faces_bb] = meshabox(bb1,bb2,0.1,1);
% merge tissue slab and sphere
[node_merged,faces_merged] = mergemesh(node_hs,faces_hs,node_box,faces_box);
% sphere should be inside the domain of the bounding box:
[cnode,cface] = surfboolean(node_bb,faces_bb,'first',node_hs,faces_hs);
subplot(1,2,1)
plotmesh(cnode,cface,'x>11.27'); % looks reasonable
% the tissue slab should be inside of (bounding box + hemisphere)
[newnode,newface] = surfboolean(cnode,cface,'first',node_box,faces_box); % doesn't look right
subplot(1,2,2)
plotmesh(newnode,newface,'x>11.27');
%% create the skin-vessel benchmark mesh
[no,fc]=latticegrid([0 200],[0 200],[20 32 200]); % create a 3-layer tissue
fc2=cell2mat(fc);
fc=[fc2(:,[1 2 3]); fc2(:,[1 3 4])];
%[ncy,fcy]=meshacylinder([-1,99.5,99.5],[201,99.5,99.5],20,5); % add the vessel
[ncy,fcy]=meshasphere([100 100 200],20,4,5); % add the vessel
[newnode,newelem]=surfboolean(no,fc,'first',ncy,fcy); % merge the two domains
%c0=[10,100,150,26]';c0=[10 100 199 26]';seeds=[ones(4,2)*100, c0]; % define the regions by index
%ISO2MESH_TETGENOPT='-Y -A'
[cfg.node,cfg.elem]=s2m(newnode,newelem(:,1:3),1,30,'tetgen',seeds); % creating the merged mesh domain
plotmesh(cfg.node,cfg.elem,'x>100')
--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To post to this group, send email to iso2mes...@googlegroups.com.
Visit this group at https://groups.google.com/group/iso2mesh-users.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2me...@googlegroups.com.
To post to this group, send email to iso2me...@googlegroups.com.