主要内容

按照修改的边界变换二维网格

变换二维域的网格以适应对域边界的修改。

加载数据。要变换的网格由 trifexfeyfe 定义,它是面-顶点格式的三角剖分。

load trimesh2d
clf
triplot(trife,xfe,yfe)
axis equal
axis([-10 310 -10 310])
axis equal
title("Initial Mesh")

Figure contains an axes object. The axes object with title Initial Mesh contains an object of type line.

构造背景三角剖分 - 由代表网格边界的点集构成的受约束的德劳内三角剖分。对于网格的每个顶点,计算用于定义与其背景三角剖分相关的位置的描述符。该描述符表示该封闭三角形以及与该三角形相关的重心坐标。

dt = delaunayTriangulation(x,y,Constraints);
clf
triplot(dt)
axis equal
axis([-10 310 -10 310])
axis equal
title("Background Triangulation")

Figure contains an axes object. The axes object with title Background Triangulation contains an object of type line.

descriptors.tri = pointLocation(dt,xfe,yfe);
descriptors.baryCoords = cartesianToBarycentric(dt,descriptors.tri,[xfe yfe]);

编辑背景三角剖分以将需要的修改融入域边界中。

cc1 = [210 90];
circ1 = (143:180)';
x(circ1) = (x(circ1)-cc1(1))*0.6 + cc1(1);
y(circ1) = (y(circ1)-cc1(2))*0.6 + cc1(2);
tr = triangulation(dt(:,:),x,y);
clf
triplot(tr)
axis([-10 310 -10 310])
axis equal
title("Edited Background Triangulation - Hole Size Reduced")

Figure contains an axes object. The axes object with title Edited Background Triangulation - Hole Size Reduced contains an object of type line.

使用变形的背景三角剖分作为计算的基础,将该描述符重新转换为笛卡尔坐标。

Xnew = barycentricToCartesian(tr,descriptors.tri,descriptors.baryCoords);
tr = triangulation(trife,Xnew);
clf
triplot(tr)
axis([-10 310 -10 310])
axis equal
title("Morphed Mesh")

Figure contains an axes object. The axes object with title Morphed Mesh contains an object of type line.