Example0 – Hello Triangulation

Getting Started with Fade

Fade comes as two separate libraries, Fade2D and Fade2.5D. Due to a common code base they are very similar to use. The difference is that the 2.5D version offers a z-coordinate and additional functionality. To make it easy to get started with Fade, a collection of small example source codes is contained in the download. The examples go step by step over the concepts of Fade and show how you can use Fade to solve your practical problems. New users may want to work through the 2D examples first because the described basics apply also to 2.5D.

Compiling the examples under Windows

Fade is a lightweight library. Unzip and enter the example_2D (or example_25D) folder, open the Visual Studio solution file (*.sln) for VS2008, VS2010, VS2012, VS2013 or VS2015 and compile. Find the executable in the x64 (or Win32) folder. It is best to start the executable in a command line window (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)

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

sudo apt-get install libgmp10

Enter an example directory and choose your operating system in the Makefile:

# Choose a matching distribution below:
#DISTRO :=../lib_centos6.4_${ARCHITECTURE}
#DISTRO :=../lib_ubuntu14.04_${ARCHITECTURE}
#DISTRO :=../lib_fedora24_${ARCHITECTURE}
DISTRO :=../lib_ubuntu16.10_${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 that is contained in the download: 10 lines of code triangulate 4 points and draw 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
example0 output

Example0 – HelloTriangulation: Four points are triangulated and drawn

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 *


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.