Fade2D Examples

Getting Started – Example0

Getting Started with the Fade Delaunay Triangulation

The Fade library supports 2D and 2.5D, hence it comes as two separate libraries, Fade2D and Fade2.5D. Fade2.5D is a superset of Fade2D, i.e. it is similar to use, but the points have an additional z-coordinate and there are many additional functions. To help you get started with Fade, a collection of small C++ sample source codes is included, each covering a different topic. They go through the concepts of Fade step by step and show how you can use the library to solve your practical problems.

2D, 2.5D and 3D Delaunay

Before we begin a short clarification about the dimensions:

  • Fade 2D is a classic 2D Delaunay triangulation in the xy-plane
  • Fade 2.5D is like Fade 2D a Delaunay triangulation but with lifted points. The difference to 3D is that a 2.5D point cloud describes a surface f(x,y), i.e. each coordinate pair (x,y) has only one z-coordinate. This is ideal for terrain data and other height fields, but a simple sphere could not be triangulated with 2.5D, for example.
  • A real 3D point cloud (e.g. a ball) can be triangulated with WOF or can be tetrahedralized with Fade3D.
2D Delaunay
2.5D Delaunay
3D Point Cloud

If you want to start with Fade2.5D it might be helpful to look at the 2D examples as well, because they cover the basics that also apply to Fade2.5D.

Example0 – HelloTriangulation

Let’s start with a hello world-equivalent application that triangulates 4 points and that draws the result.

// 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"");

“Note: All described example source codes are contained in the download”

Example0 – HelloTriangulation: Four points are triangulated and drawn

Compiling under Windows

  • Unzip and enter the examples_xx folder
  • Open the Visual Studio solution file (*.sln) for VS20xx and compile.
  • Find the executable in the x64 (or Win32) folder and start it in a command line window.

“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 under MacOS and Linux

  • Make sure you have gmp installed. For instance (Debian):
    sudo apt-get install libgmp10
  • Enter the examples_xx directory
  • Open the contained Makefile and uncomment only your OS version
# Choose a matching distribution below:
# DISTRO :=../lib_centos6.4_${ARCHITECTURE}
# DISTRO :=../lib_ubuntu14.04_${ARCHITECTURE}
# DISTRO :=../lib_fedora24_${ARCHITECTURE}
DISTRO :=../lib_ubuntu20.04_${ARCHITECTURE}
# DISTRO :=../lib_APPLE
# DISTRO :=../lib_raspberry_armv6l
# DISTRO :=../lib_raspberry_armv7l
  • make
  • Start the executable in the same directory

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

Leave a Reply

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