TRIANGLE is a C program that can generate meshes, Delaunay triangulations and Voronoi diagrams for 2D pointsets.
TRIANGLE generates exact Delaunay triangulations, constrained Delaunay triangulations, and quality conforming Delaunay triangulations. The latter can be generated with no small angles, and are thus suitable for finite element analysis.
TRIANGLE produces its own documentation. Complete instructions are printed by invoking the program with the `-h' switch:
triangle -h
The instructions are long; you'll probably want to pipe the output to more or redirect it to a file. The programs gives a short list of command line options if it is invoked without arguments.
You have to give TRIANGLE some input to work with. Usually, you start with a Planar Straight Line Graph (PSLG) which defines a set of points, and some nonintersecting segments that you want to be sure are included in the triangulation. This information can easily be stored in a POLY file, which is one of the expected input formats.
Normally, TRIANGLE will triangulate the entire region defined by the convex hull of the points. You may define a portion of the convex hull to be a "hole", which is not to be triangulated. This is done by adding some hole information to your POLY file.
FEM_BASIS_T3_DISPLAY is a MATLAB program which displays a basis function associated with a linear triangle ("T3") mesh.
FEM_BASIS_T6_DISPLAY is a MATLAB program which reads a quadratic triangle mesh and displays any associated basis function.
POLY is a data directory which contains a description and examples of the POLY file format.
SHOWME is an executable C program that can display the POLY files uses as input to TRIANGLE, and the output files that define meshes and other objects.
TABLE_DELAUNAY is an executable FORTRAN90 program which can create a three-node triangulation of a given set of points.
TEST_MESH is a FORTRAN90 library of routines which defines a few test meshes which can be output in POLY format for use with TRIANGLE.
TEST_TRIANGULATION is a FORTRAN90 library of routines which defines a number of test regions, and can generate triangulations and output them in POLY format.
TRIANGULATE is an executable C program which reads data defining a polygon and produces a PostScript file describing a triangulation of the polygon.
TRIANGULATION_BOUNDARY_NODES is an executable FORTRAN90 program which reads data defining a triangulation, determines which nodes lie on the boundary, and writes their coordinates to a file.
TRIANGULATION_DISPLAY_OPEN_GL is an executable C++ program which reads files defining a triangulation and displays an image using Open GL.
TRIANGULATION_L2Q is a FORTRAN90 library of routines which takes a 3-node triangulation and makes a 6-node triangulation, by inserting new nodes.
TRIANGULATION_PLOT is an executable FORTRAN90 program which can create an EPS plot of either a three-node or six-node triangulation.
TRIANGULATION_Q2L is an executable FORTRAN90 program which reads data defining a 6-node triangulation, and subdivides each triangle into 4 3-node triangles, writing the resulting triangulation to a file.
TRIANGULATION_QUALITY is an executable FORTRAN90 program which reads data defining a triangulation and computes a number of quality measures.
TRIANGULATION_RCM is an executable FORTRAN90 program that reads data defining a triangulation, determines an ordering of the nodes that will reduce the bandwidth of the adjacency matrix, and writes the new triangulation information to a file.
TRIANGULATION_REFINE is an executable FORTRAN90 program that reads data defining a triangulation, replaces each triangle by four congruent smaller ones, and writes the new triangulation information to a file.
TRIANGULATION_TRIANGLE_NEIGHBORS is an executable FORTRAN90 program that reads data defining a triangulation, determines the neighboring triangles of each triangle, and writes that information to a file.
Jonathan Shewchuk,
Computer Science Division,
University of California at Berkeley,
Berkeley, California, 94720-1776
jrs@cs.berkeley.edu.
Try out TRIANGLE on the sample file, A.poly:
triangle -p A.poly
TRIANGLE will read the Planar Straight Line Graph defined by A.poly, and write its constrained Delaunay triangulation to A.1.node, A.1.ele and A.1.poly.
For contrast, try running
triangle -pq A.poly
Now, click on the same "ele" button. A new triangulation will be loaded;
this one having no angles smaller than 20 degrees.
To see a Voronoi diagram, try this:
cp A.poly A.node
triangle -v A
A.POLY is a planar straight line graph of the capital letter A. We use it as input to get a constrained Delaunay triangulation.
BOX.POLY is a planar straight line graph of a double box. We use it as input to get a constrained Delaunay triangulation.
DIAMOND_02_00009.NODE is another set of test data, for which we want the Voronoi diagram.
DOUBLE_HEX.POLY describes a unit square with two hexagonal holes. 72 points are listed on the outer boundary, and 12 on each of the holes. It is desired to create a nice looking mesh of about 500 nodes, and no additional nodes on the boundary segments.
triangle -p double_hex.polyrequests that we triangulate the current points:
triangle -pqY -a0.0015 double_hex.1.polyrequests that we triangulate the current points, adding new nodes as necessary to make a nice mesh, with no triangle being larger than 0.0015 in area, and with no points added on boundary segments. We end up with 525 nodes and 956 elements:
DOUBLE_HEX2.POLY describes a unit square with two hexagonal holes. 36 points are listed on the outer boundary, and 6 on each of the holes. It is desired to create a nice looking mesh of about 235 elements, and no additional nodes on the boundary segments.
triangle -p double_hex2.polyrequests that we triangulate the current points:
triangle -pqY -a0.0060 double_hex2.1.polyrequests that we triangulate the current points, adding new nodes as necessary to make a nice mesh, with no triangle being larger than 0.0060 in area, and with no points added on boundary segments. We end up with 141 nodes and 236 elements:
SQUARE_CIRCLE_HOLE.POLY is a planar straight line graph of a square region with an off center circular hole, and 826 points computed by a CVT calculation, prepared by Hua Fei.
You can go up one level to the C source codes.