Getting Started – Example0

Getting Started with the Fade Delaunay Triangulation

The Delaunay triangulation library supports 2D and 2.5D, hence it comes as two separate libraries, Fade2D and Fade2.5D. They have a common code base and thus they are very similar to use. The difference is a z-coordinate and additional functionality in the 2.5D version. To facilitate your start with Fade, a collection of C++ example source codes is contained. The examples are small and well documented. They go step by step over the concepts of Fade and show how you can use the library to solve your practical problems.

Download Fade2D and Fade2.5D

2.5D Delaunay vs. 2D and 3D Delaunay

Before we start, a short clarification of 2.5D:

  • 2D Delaunay is a classic triangulation in the plane (xy-points)
  • 2.5D Delaunay is like a 2D triangulation but with lifted points (e.g., a terrain, a half ball etc.)
  • A 3D Delaunay triangulation refers to a tetrahedral mesh
2D Delaunay Triangulation

2D Delaunay Triangulation, Fade2D

2.5D Delaunay

2.5D Delaunay Triangulation, Fade2.5D

3D Surface

3D Tetrahedralization, Fade3D

One can think of Fade2.5D as a classic 2D triangulation with elevated vertices: The advantage of 2.5D Delaunay software compared with 3D Delaunay is that it computes a triangulation while 3D Delaunay is a tetrahedralization. Be aware that 2.5D Delaunay surfaces have a unique elevation z per (x,y) coordinate pair and thus vertical walls and overhanging elements like in 3D are not possible.

If you are new to Fade you should work through the 2D source codes (Example0 – Example6) first. The basics are described there and they apply also to 2.5D triangulations.

Compiling the examples under Windows

Fade is a lightweight library, thus you can simply unzip and start: Enter the example_2D (or example_25D) folder, open the Visual Studio solution file (*.sln) for VS2010, VS2012, VS2013, VS2015, VS2017 or VS2019 and compile. Find the executable in the x64 (or Win32) folder.

It is best to start the executables in a command line window. Hint: In a Windows Explorer window mark the address bar and type “cmd” to open a command line window at the same path.

Compiling the examples under MacOS and Linux (PC, Raspberry PI)

Use the package manager or graphical installer of your operating system to install libgmp. For Debian, Raspbian, Ubuntu the command is for example

sudo apt-get install libgmp10

Enter the examples_2D or examples_25D directory and edit the contained Makefile to match your operating system:

# Choose a matching distribution below:
#DISTRO :=../lib_centos6.4_${ARCHITECTURE}
#DISTRO :=../lib_ubuntu14.04_${ARCHITECTURE}
#DISTRO :=../lib_fedora24_${ARCHITECTURE}
DISTRO :=../lib_ubuntu17.04_${ARCHITECTURE}
#DISTRO :=../lib_APPLE
#DISTRO :=../lib_raspberry_armv6l
#DISTRO :=../lib_raspberry_armv7l

Ready. Now type make to compile and start the executable in the same directory.

Example0 – HelloTriangulation

Let’s start with a hello world equivalent application: 10 lines of code triangulate 4 points and draw the result.

Note: All described example source codes are contained in the download
// An empty triangulation
Fade_2D dt;  

// 4 points
Point2 p0(0.0,0.0);
Point2 p1(1.0,0.0);
Point2 p2(0.5,2.0);
Point2 p3(0.5,0.5);

// Insert the points

// Draw as postscript graphic""); 
Output, drawn by the Hello-Triangulation example

Example0 – HelloTriangulation: Four points are triangulated and drawn

The next example benchmarks the performance of Fade on your computer.

Spread the word. Share this post!

Leave A Reply

Your email address will not be published. Required fields are marked *


By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.