Uniform triangulation refinement
Syntax
rTR = trirefine(TR)
rTRn = trirefine(TR,n)
[rTR1, rTR2,~,rTRn] = trirefine(TR,n)
Description
rTR = trirefine(TR), returns a triangulation that is a uniform refinement of the input triangulation TR. Each triangle of TR is subdivided into 4 triangles by joining the midpoints of the edges; see examples below.
rTRn = trirefine(TR,n), same as above but successively refines the input triangulation TR n times.
[rTR1, rTR2, …, rTRn] = trirefine(TR,n), same as above but returns the sequence of n refined triangulations. Note: The output can also be saved to a cell array using the notation [rTR{1:n}] = trirefine(TR,n).
Examples
The examples below make use of a simple triangulation of a hexagon defined by the following spatial parameters
r = sqrt(6*pi/(pi-6*sqrt(3)/4));
x = [ -r, -r/2, r/2, r ];
y = [ -sqrt(r^2-(r/2)^2), sqrt(r^2-(r/2)^2) ];
Given these parameters, the following points and connectivity list are defined
Points = [ x(2) y(1); x(3) y(1); x(1) 0; 0 0; x(4) 0; x(2) y(2); x(3) y(2) ]
ConnectivityList = [ 1 2 4; 2 5 4; 4 5 7; 4 7 6; 3 4 6; 1 4 3 ];
And the triangulation can be constructed and visualized by
TR = triangulation(ConnectivityList,Points);
figure; hold on; box on; daspect([1 1 1]);
title(‘Original triangulation TR’);
triplot(TR,‘k’,‘LineWidth’,3)
Example 1 − A single uniform refinement
Consider a single uniform refinement of TR obtained by
rTR1 = trirefine(TR);
Plotting the refined triangulation along with the original
figure; hold on; box on; daspect([1 1 1]);
title(‘Uniform refinement of TR’)
triplot( TR ,‘k’,‘LineWidth’,3.0);
triplot(rTR1,‘r’,‘LineWidth’,1.5)
Note that the uniform refinement is obtained by simply subdividing each triangle of the original triangulation into 4 triangles by joining the midpoints of the edges.
Example 2 − A sequence of refinements
A successively refined triangulation can be obtained by including an optional input argument specifying the number of refinements to be performed, e.g.,
rTR2 = trirefine(TR,2);
Visualizing this triangulation along with the original triangulation and the first refinement
figure; hold on; box on; daspect([1 1 1]);
title(‘Two successive uniform refinements of TR’)
triplot( TR ,‘k’,‘LineWidth’,3.0);
triplot(rTR1,‘r’,‘LineWidth’,1.5);
triplot(rTR2);
The sequence of refinements can also be obtained in one step by
[rTR1, rTR2] = trirefine(TR,2)
Alternatively, they can be stored in a cell array by
[rTR{1:2}] = trirefine(TR,2)
This function is part of……..