# 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.

## 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 xy-plane
• 2.5D Delaunay is a 2D triangulation in 3D
• 3D Delaunay is tetrahedralization

One can think of Fade2.5D as a classic 2D triangulation with elevations of the 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 are like a function z=f(x,y) with 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 VS2008, VS2010, VS2012, VS2013, VS2015 or VS2017 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 examples25D 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.

```// An empty triangulation

// 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
dt.insert(p0);
dt.insert(p1);
dt.insert(p2);
dt.insert(p3);

// Draw as postscript graphic
dt.show("example0.ps");
```

Example0 – HelloTriangulation: Four points are triangulated and drawn