Hi there, new draft here (Civil engineering background) and glad to join the community! I am currently trying to convert a 2D XRD image (sample figure attached) into a 2D triangular mesh. In the mesh, triangular elements in different aggregates (distinguished by different colour patterns in the attached figure) will be assigned with different mechanical properties during the numerical simulation using combined FEM/FDEM.I quickly walked through the function list, it seems that most of them are dedicated to 3D mesh generation using 2D surface or 2D volumetric image. I feel like my case should be the easiest scenario while I failed to located the proper function.
hi Jiazheng
iso2mesh was not designed for 2D meshing, but given the versatility, you can certain hack it for that purpose
here is my sample script, the output 2D mesh actually looks quite nice. the screenshot is attached.
% load your 2D image
img=imread('UCS1_3agg+1paste_cl_filltered.tif');
% expand 2D image in z to get a 3D volume
im=repmat(img,1,1,10);
% use v2m to create a mesh
[no,el]=v2m(im,[],struct('radbound',100,'distbound',1),1000,'cgalmesh');
% extract the exterial surface and get their label
[fc,flabel]=volface(el(:,1:4));
flabel=el(flabel,5);
% remove interior nodes to compress the node data
[no2,fc2]=removeisolatednode(no(:,1:3),fc);
% calculate the centroids of each surface triangle
c0=meshcentroid(no2,fc2);
% find only the triangles roughly located in the bottom face
idx=find(c0(:,3)<2 & c0(:,1)>1 & c0(:,1)<size(img,1)-1 & c0(:,2)>1 & (c0(:,2)<size(img,2)-1));
% extract the bottom surface, and flatten the z-coordinate to 0
no3=no2;
no3(:,3)=0;
fc3=[fc2(idx,:) flabel(idx)];
% plot the final 2D mesh
plotmesh(no3,fc3)
% find the open-edge of the 2D mesh, and plot in red
ed=surfedge(fc3(:,1:3));
edgeloop=extractloops(ed);
hold on
plotmesh(no3,ed,'color','r','linewidth',2);
the triangle labels from the output mesh automatically matches your image pixel region labels.
the distbound in the v2m call is important. if you make it smaller, the adaptive refinement near the edge will be more refined (thus more nodes), and the flatness at the bottom face is also improved (variation is bounded by distbound, for example, if distbound=1,
the bottom surface is allowed to deviate from the flat bottom by max 1 voxel).
feel free to play with it.
Qianqian
--
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 iso2mesh-use...@googlegroups.com.
To post to this group, send email to iso2me...@googlegroups.com.
Hi Qianqian,recently, here raises another issue about the 2D mesh. detailed problem description is illustrated in the attached figure. in general, the boundaries between the steel platten and concrete body need to be plain to avoid any local confinement (e.g. interlock effect, etc). I have tried some mesh modification functions provided in the list. no lucks yet. I feel most of them are trying to modify the mesh arrangement base on the norm of each element, which does not give a big difference for 2D mesh. I am wondering if there is any way to achieve the idea case? my .m file is also attached.
hi Jiazheng
this seems to be a plotting issue. just replace
plotmesh(no3,fc3)
to
plotmesh(no3(:,1:3),fc3)
should solve the problem.
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.