
Introduction
This program generates Triangulated Irregular Network, or TIN from scattered points on two-dimensional plane based on Delaunay's triangulation. This data structure allows data to be displayed as three-dimensional surface, or to be used for terrain analysis including contouring and visibility mapping.
Using the code
The source codes, if successfully compiled will generate a simple console program which only takes two arguments. The first argument should be a name of the points file. Points are read from this simple text file with a list of X-Y, or X-Y-Z coordinates separated by comma. Although z coordinates are not used in the calculation, data with altitude information can be used for perspective viewing in demo program, TriNET. Below is example of input file for data shown in the figure:
200,790
370,760
60,670
360,890
280,620
30,880
230,960
or,
200,790,100
370,760,110
60,670,115
360,890,92
280,620,125
30,880,95
230,960,110
The list of triangles is saved to triangle file. Triangle file is generated in the same directory as the input file with extension "tri". The output file will look like this. In this example, six triangles are generated and in the resulting "tri" file, sequential numbers of generated triangle vertices are listed as below:
1,6,7
1,3,6
2,7,4
1,2,5
1,7,2
1,5,3
For example, the first triangle(A) consists of the first, sixth and seventh vertices in the input file.

Two point files, Davis.nod and test32.nod are included in this distribution file as examples.
Notes on algorithm
The second argument to this program decides whether the convex hull is used or not. If this is set to N, or no second argument is given, in order to generate triangles beyond the area boundary, a set of pseudo points are generated around the extents of the points.
Contrarily, if 'Y' is given to this parameter, the convex hull is generated and is used as a boundary of the input area. Convex hull (in 2D) is a smallest convex polygon, which include all input points. As shown in the example below, as compared to the network in the left, all parts in the convex hull are triangulated in the right figure, but it tends to create triangles of irregular shape(blue triangles in the right figure), which do not fulfill the condition that the largest inner angles of all generated triangles must be minimized.
Demo Program
I added Windows program, TriNET to interactively run and display the results of triangulation. To construct TIN from a set of scattered points, select from a menu, "Terrain" -> "Construct TIN" or "Construct TIN - Convex Hull" and select points file from dialog. Check the menu item, "Terrain" -> "Display Monitor" to observe the process of triangulation real time. This has no effect in the result of calculation except that it makes it significantly slower. It is just for fun! Input points and generated triangles can be displayed in TriNET. If the points have z coordinates, generated TIN can be used for perspective viewing. Select each function from "Draw" menu.


In three-dimensional display, use left and right arrows to rotate horizontally, and up and down key to change the depression angle. F1 and F2 keys widen and narrow the field of view.
TriNET requires GDI+ library. The runtime module can be obtained at the website of the Microsoft. Copy gdiplus.dll to windows system directory. TriNET also requires MFC71.dll and msvcr71.dll.
References
This program uses Delaunay's triangulation method. There are a number of documents published or available on the net about this algorithm. I used a book written by John C. Davis, "Statistics and Data Analysis in Geology, Third Edition", John Wiley and Sons(2002), which included very plane but thorough description on this algorithm.
History
- First upload, 14/4/2004 - Only hoping people don't have to vomit after reading my English.
| You must Sign In to use this message board. |
|
|
 |
|
|
 |
|
 |
Thank you for sharing your application and code here. I am a student from China. Now I am trying to use delaunay trangulation to construct 3D terrain. I have learned a lot from your work, but I cann't compile your code on my computer, and I haven't found your code the way how you do the 3D graph. I wonder if you can give me the MFC code about your delaunay trangulation work,especially the code the way how you do the 3D graph. I will appreciate it very much. Tank you very much! My e-mail: dlzhang.lei@163.com Look forward to replying! Please forgive my indecorum.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Hello,Mr.Kazumi Sato! Thank you for sharing your application and illumining me!I am a student from China.I am doing something about 3D graphic display for my Graduation Design.
In your source codes,you are suppose to give the way about how to calulate the points' index to draw triangles.But the question is how to achieve 3D Delaunay's triangulation and to deal with the points in the .node files. And if the 3D object is a ball or cylinder,is it still right?
Two questions. If you have some suggestion,could you tell me?I want to draw a sphere with a lot of triangles. My e-mail: ad_8891@hotmail.com Look forward to replying! Please forgive my indecorum.Warmest wishes for your everyday.
Tonio Ann
Ps: My terrible English grammar!Sorry!
modified on Monday, February 16, 2009 7:43 PM
|
| Sign In·View Thread·PermaLink | 3.50/5 |
|
|
|
 |
|
 |
Hi Kazumi,
I have done my Delaunay triangulation but in a slightly different way as you did. I'm working under C#. I was looking at your code the way how you do the 3D graph, however, I haven't found it. Did you add that file to the program that is available to download, it means, the source code, or it is part of the application (.exe)? If you added the 3D module only into the application, I would like to know how you did it. I'm currently developing my project to get my degree, but the deadline to give my project to my uniiversity is close. If you can please can tell me, I would really appreciate it and I would be so grateful with you. I'm a little desperated and to be honest I haven't found a lot of information about 3D Delaunay's triangulation or at least a way to make the graph under C#.
Thanks a lot for your attention.
Farid.
|
| Sign In·View Thread·PermaLink | 5.00/5 |
|
|
|
 |
 | Cube  henry1103 | 22:39 28 Apr '08 |
|
 |
0,0,0 0,0,1 0,1,0 0,1,1 1,0,0 1,0,1 1,1,0 1,1,1
I tried the above, and got something rubbish. I suppose it does not handle points at the same (x,y) with different z values, e.g. 0,0,1 and 0,0,2 and 0,0,3 , etc...
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
 | good  Marco Magi | 0:32 5 Jun '07 |
|
 |
Thanks to mr. Kazumi Sato , I'm an italian student of engineering for virtual reality's system for molecular 3D design maker. I'm examining these codes for my graduation work for the realization of an algorithm for locating binding sites in protein structures . It's an hard work . But your codes makes this more simple ;P.
Thanks mr. Sato
Giammarco
ps: sorry for my wrong english.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
It apears that the algorythm is O(N*N).On my computer I could'nt even triangulte 10,000 points. Beware !
|
| Sign In·View Thread·PermaLink | 1.50/5 |
|
|
|
 |
|
 |
Somewhere in the source code there is:"remove points with identical X and Y coordinates"
Because of that when i put a nod file with the coordinates of a 3d cube, the produced triangles produce a pyramid and not a 3d cube....
why?
Thanks!
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Hi to all of you, I have a question.
Why when a put a txt file with 3 points the output of the program is 15 trianglesa and not one?
i think it has to do with #define DISTANCE_PITCH ( 1.0 ) #define PSEUDO_POINT_COUNT ( 0.0 ) #define STANDARD_BOX_COUNT ( 0.0 )
but i don't khow......
Please Help me
|
| Sign In·View Thread·PermaLink | 1.60/5 |
|
|
|
 |
|
 |
Hi
My name is Thiago Arreguy, i am a student of engineering of control and automation at Universidade Federal de Minas Gerais (UFMG)in Brazil. I used your code of Delaunay triangulation for my graduation work. It´s very good.
Thank you and sorry my english.
Thiago Arreguy
|
| Sign In·View Thread·PermaLink | 5.00/5 |
|
|
|
 |
|
 |
Hi,
I get an out of memory message trying to load a file that has less than 100000 records.
This seems to be a very small limit...
I checked the memory usage, and the software was close to the 2GB barriere (Windows XP 32 bits).
Is this normal ?
Zindine
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
 |
I have greatly appreciated your program and used it in a Geografical Information System in France, for a little village near Nice (pb = to position raster images).
But, can you send me your MFC code (or some indication) used here to represent the 3D surface, after having obtained the list of Delaunay's triangles ?
Thank you.
Jac
|
| Sign In·View Thread·PermaLink | 1.86/5 |
|
|
|
 |
|
 |
Did you get an answer? Currently, I'm needing the 3D surface code either. If you have some info, I would really appreciate it.
Thanks 
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
Dear Mr. Sato
My name is Anes Durgutović and I am a student of Faculty of Natural Science and Engineering, more precisely, Department of Geotechnology and Mining (University of Ljubljana). At the moment, in collaboration with my mentor Assistant Professor dr. Milivoj Vulic, I am writing my diploma titled Methods for Calculation Volume on Irregular Shapes.
When I was searching for some more information and literature for my diploma, I came across your program for triangulation named TRIANGLE NET. The program is very good and practical, therefore, I find it rather useful when I am writing my diploma.
Therefore, I ask for your permission to use your program for my diploma. So, please send me your response on my email: anes.drugo@email.si or on my mentor’s email: mvulic@gmx.net . If you have any questions, please do not hesitate to contact me.
I look forward to your response
Yours sincerely, Anes Durgutovic
|
| Sign In·View Thread·PermaLink | 1.67/5 |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
I looked carefully at your code and you are reading a 3D point(X,Y,Z) into a vector Pnt3List, then later transfert (X,Y) only into vector Pnt2List. You then call for Triangulation and store results in vector TriList (Seems like 3D). And the the results like a 3D Points. Why did you flush the Z data at first ? I know we can build back a 2D triangle with only X,Y, but you're sample program was able to build FACETS... Do you still read again the NOD file with the TRI both together in order to generate the correct FACETS ?
|
| Sign In·View Thread·PermaLink | 3.00/5 |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|