수정된 경계에 2차원 메시 모핑하기
2차원 영역의 메시를 모핑하여 영역 경계의 수정 사항을 수용합니다.
데이터를 불러옵니다. 모핑할 메시는 면-꼭짓점 형식의 삼각분할인 trife, xfe, yfe에 의해 정의됩니다.
load trimesh2d clf triplot(trife,xfe,yfe) axis equal axis([-10 310 -10 310]) axis equal title("Initial Mesh")

배경 삼각분할, 즉 메시 경계를 나타내는 점 집합에 대해 제약 조건이 적용되는 들로네 삼각분할을 생성합니다. 메시의 각 꼭짓점에 대해 배경 삼각분할과 관련하여 꼭짓점의 위치를 정의하는 descriptor를 계산합니다. 이 descriptor는 해당 삼각형에 대한 무게중심 좌표를 함께 갖고 있는 바깥쪽 삼각형입니다.
dt = delaunayTriangulation(x,y,Constraints); clf triplot(dt) axis equal axis([-10 310 -10 310]) axis equal title("Background Triangulation")

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")

변형된 배경 삼각분할을 계산의 기반으로 사용하여 descriptor를 다시 카테시안 좌표(Cartesian Coordinate)로 변환합니다.
Xnew = barycentricToCartesian(tr,descriptors.tri,descriptors.baryCoords); tr = triangulation(trife,Xnew); clf triplot(tr) axis([-10 310 -10 310]) axis equal title("Morphed Mesh")
