Using generateMesh to refine a triangulation, without losing boundary points
16 views (last 30 days)
Show older comments
I'm trying to refine a constrained Delaunay triangulation mesh automatically along the lines of Chew's algorithm. I was hoping to use MATLAB's generateMesh function, which does a nice job refining the mesh -- except that the mesh boundaries are not respected. Is there a way of forcing the generateMesh function to preserve the edge bounds?
In the example below, I have a smooth curve whose shape is distorted by generateMesh. It's not horrible in this case, but this is just an toy model for coastline polygons, where it's important to not lose any of the shape.
N= 100;
t= (1:N)/N*2*pi;
X= 1*cos(t)+ .15*cos(3*t)+ .1*sin(5*t);
X= X/range(X)*.9;
X= X- min(X) -.1;
Y= 1*sin(t)+ .5*cos(4*t)+ .4*sin(6*t);
Y= Y/range(Y)*.8;
Y= Y-min(Y)+.1;
% Create polyshape
P= polyshape(X,Y);
% Constrained triangulation of the polyshape
TRI= triangulation(P);
% Create mesh from original triangulation
model= createpde;
geometryFromMesh(model,TRI.Points',TRI.ConnectivityList');
figure(1)
tiledlayout('flow')
nexttile
plot(P)
title('Polyshape')
nexttile
pdemesh(model)
axis normal
title('Original Triangulation')
% Refine mesh
generateMesh(model,'Hmax',.3);
nexttile
pdemesh(model)
title('Distorted Shape')
0 Comments
Answers (1)
Samyuktha
on 24 May 2023
Hi Zel,
I understand that you wish to use the 'generateMesh' function to preserve the edge bounds.
Please refer to 'Refine Mesh on Specified Edges and Vertices' in the 'Examples' section of the documentation generateMesh, in order to generate a 2-D mesh with finer spots around the specified edges and vertices.
Hope it helps!
0 Comments
See Also
Categories
Find more on Geometry and Mesh in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!