Watch, Follow, &
Connect with Us

ID: 29365, Delaunay triangulation and contouring code

by Richard Winston Email: Anonymous


This program demonstrates routines for generating constrained Delaunay triangulations and for plotting contour lines based on data points at arbitrary locations.
Download Details
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 7.0  to 17.1 81 downloads
Copyright: Commercial use requires permission


Size: 1,101,470 bytes
Updated on Fri, 25 Oct 2013 18:45:05 GMT
Originally uploaded on Wed, 27 Mar 2013 10:23:59 GMT
SHA1 Hash: 6BAAF75348594917F18023AD6C6E5E6FE7C8EC09
MD5 Hash: 49E1DE40FFDAE4CCBC6B607183068F23

    Explore the files in this upload

Description
This program demonstrates routines for generating constrained Delaunay triangulations and for plotting contour lines based on data points at arbitrary locations. The routines were translated from FORTRAN code. See http://www.netlib.org/toms/626 and http://www.netlib.org/toms/751 for the original code.

The main routine for generating the contour lines is TRICP_Pascal in TriCP_Routines. There is also a routine for generating a Delaunay triangulation (IDTANG_Pascal).

The main routine for generating the triangulation is TRMESH in TriPackRoutines. You can use EDGE in TriPackRoutines to constrain the triangulation after first creating it with TRMESH. DELETE or DELETE2 can be used to delete edges from the triangulation. DELETE is more picky but will never result in an invalid mesh. DELETE2 can leave the mesh in an invalid state such as having some nodes have only one edge leading to them. However, such a mesh can still be used with TRICP_Pascal. However, the format used to describe the triangulation is different from the one used by TRICP_Pascal. The routine Trmesh_2_Idtang can be used to convert the format generated by TRMESH to the one used by TRICP_Pascal.

Output from the procedures in TriCP_Routines is sent to procedures in CalCompRoutines. Output from the procedures in TriPackRoutines is sent to procedures in TriPackMessages. You can modify those procedures to handle the output differently than is done in this program.

One thing to keep in mind is that in Fortran arrays are one-based instead of zero-based as in Pascal. Because of this, the node numbers used in TRMESH, EDGE, DELETE, and DELETE2 follow that convention. Thus if you use DELETE2 to delete the edge between node numbers 1 and 4, it will delete the edge between the node at (X[0], Y[0]) and (X[3], Y[3]).

In TriCP_Routines, I have converted the node numbers to use zero-based arrays instead of one-based arrays.

If you want to just generate contour lines and you don't care too much about the triangulation on which the contours are based, you can just call TRICP_Pascal with MODE = 0. If you only want to draw the contours inside a concave polygon, you need to supply a suitable triangulation. You can create a suitable triangulation using TRMESH followed by some calls to DELETE2 followed by Trmesh_2_Idtang. You would then pass this triangulation on to TRICP_Pascal with MODE = 1. There are also modes 2 and 3. See the comments in the body of TRICP_Pascal for more details.

The demonstration program can run either the original FORTRAN source compiled into a dll or the Pascal equivalents. The dll was compiled with Lahey FORTRAN version 5.5. The source code for the dll is in a separate directory. There appears to be a bit of a problem with running the FORTRAN code on 64-bit computers. The first test will generate incorrect contours in the triangle #1 of the second diagram of the first test. On 32-bit computers the problem does not seem to occur. Also if the program is compiled with Delphi 2006, the problem does not occur on 64-bit computers. No such problem occurs with the equivalent Pascal code. For more details see Demo1.

This program has been tested with Delphi 7, Delphi 2006, and Delphi XE2.

Although all of the files in this program are in the public domain, the algorithms used in TriCP_Routines are TriPackRoutines are subject to copyright by ACM. For conditions of use, see http://www.netlib.org/toms/ and http://www.acm.org/publications/policies/softwarecrnotice.

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Server Response from: ETNACDC02