in the latest version 1.4.x series, iso2mesh added several functions
to
address surface intersections. If you plan to mesh the intersecting
spheres as a single combined region, you can do it with a
combination of
surfboolean() and meshcheckrepair('meshfix'). Please run the
following
example to understand the workflow:
% define 3 spheres
[no1,fc1]=meshasphere([0 0 0], 10, 0.5);
[no2,fc2]=meshasphere([8 0 8], 5, 0.5);
[no3,fc3]=meshasphere([-8 0 8], 5, 0.5);
% combine 3 spheres and clean the surface
[no,fc]=surfboolean(no1,fc1,'and',no2,fc2,'or',no3,fc3(:,[1 3 2]));
% Note: the funny 'and'/'or' operators here were due to the
% orientations of the surfaces
[no_f,fc_f]=meshcheckrepair(no,fc(:,1:3),'meshfix');
plotmesh(no_f,fc_f,'y>0')
% create volumetric mesh from the cleaned surface
[node,elem,face]=s2m(no_f,fc_f,1,1);
figure; plotmesh(node,elem,'y>0')
This works fine on linux, I know on windows the surfboolean
may fail due to a libgts bug.
if you want to mesh the intersecting regions as multiple
compartments, even though surfboolean can generate
these internal surfaces, unfortunately meshfix can not
process the output as it can only handle a single closed
surface at this point.
Re your question on the concentric spheres, yes, iso2mesh
can handle that without any trouble. You simply define
two interior points as "regions" in surf2mesh, one inside
the inner sphere, one in between the two shells, surf2mesh
should be able to label the two regions accordingly.
Qianqian