triangulation_refine_local, a MATLAB code which tries to locally refine a triangulation by replacing one triangular element by four smaller ones.

The refinement process introduces three new nodes, at the midsides of the original element. This, in turn, will create what is called "hanging nodes" on the neighboring elements, an undesirable feature. Therefore, each hanging node is used to divide the neighboring element into two new elements. This removes the hanging node problem.

Information about the triangulation is updated. In particular, the coordinates of the three new nodes are assigned indexes, and added to the node coordinate array. Four old elements are replaced by 10 new, smaller ones. This requires modifications to the element-node array and to the element-neighbor array.

This process of refinement does not take into account the shape of the new elements. The refinement process could create a new triangulation which no longer has the Delaunay property. If this is a concern, then a simple expedient is to retriangulate the nodes.

The program presented here presumed the triangulation involves order 3 elements, that the element-node array lists the nodes in counter-clockwise order, and that the element neighbor array indexes the element neighbors by the element node that is opposite to them. If any of these assumptions do not hold for the given data, the calculation will need to be modified.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


triangulation_refine_local is available in a MATLAB version.

Related Data and Programs:

triangulation, a MATLAB code which carries out various operations on order 3 ("linear") or order 6 ("quadratic") triangulations.

triangulation_boundary_edges, a MATLAB code which reads data defining a triangulation, determines which edges lie on the boundary, organizes them into connected components, and writes this information to a file.

triangulation_boundary_nodes, a MATLAB code which reads data defining a triangulation, determines which nodes lie on the boundary, and writes their coordinates to a file.

triangulation_corner, a MATLAB code which patches triangulations so that no triangle has two sides on the boundary.

triangulation_delaunay_discrepancy, a MATLAB code which measures the amount by which a triangulation fails the local delaunay test;

triangulation_display, a MATLAB code which displays the nodes and elements of a triangulation on the MATLAB graphics screen;

triangulation_order3, a data directory which contains a description and examples of order 3 triangulations.

triangulation_orient, a MATLAB code which reads data defining a triangulation, makes sure that every triangle has positive orientation, and if not, writes a corrected triangle file.

triangulation_plot, a MATLAB code which reads data defining a triangulation and creates a postscript image of the nodes and triangles.

triangulation_quality, a MATLAB code which reads data defining a triangulation and computes a number of quality measures.

triangulation_refine, a MATLAB code which refines a triangulation.


triangulation_triangle_neighbors, a MATLAB code which reads data defining a triangulation, determines the neighboring triangles of each triangle, and writes that information to a file.


  1. Marc deBerg, Marc Krevald, Mark Overmars, Otfried Schwarzkopf,
    Computational Geometry,
    Springer, 2000,
    ISBN: 3-540-65620-0.
  2. Joseph ORourke,
    Computational Geometry,
    Second Edition,
    Cambridge, 1998,
    ISBN: 0521649765,
    LC: QA448.D38.

Source Code:

Last revised on 11 April 2019.