The best way to illustrate the functionality provided by the library is through programs that users can compile, run, copy and modify to their hearts' content. Thus every package should contain some of these programs. In CGAL we distinguish between two types of programs: those that provided graphical output (demos) and those that do not (examples).
In this chapter we provide guidelines for the development of these programs and their inclusion in the documentation. See Sections 4.3 and 4.4 for a description of the directory structure required for example and demo programs, respectively. Note in particular that each directory should contain a README file that explains what the programs do and how one interacts with them.
Remember that these programs are likely to be a user's first introduction to the library, so you should be careful to follow our coding conventions (Chapter 6) and good programming practice in these programs. In particular:
//
// file : examples/Generator/random_polygon_ex.C
//
using namespace CGAL;
using namespace std;
We discourage the use of these as they introduce more names than
are necessary and may lead to more conflicts than are necessary.
#include <CGAL/Cartesian.h>
instead of:
#include <basic.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Triangle_2.h>
#include <CGAL/Segment_3.h>
// etc.
typedef CGAL::Cartesian<double> Kernel;
typedef Kernel::Point_2 Point_2;
typedef Kernel::Triangle_3 Triangle_3;
instead of this syntax:
typedef CGAL::Cartesian<double> Kernel;
typedef Point_2<Kernel> Point_2;
typedef Triangle_3<Kernel> Triangle_3;
Although both will work, the former is to be preferred since
it reflects that the types are actually part of the kernel and
also reflects the new (as of release 2.3) kernel design that allows
types to be easily exchanged and adapted.
Note also that the typedef used above is
typedef CGAL::Cartesian<double> Kernel;
instead of
typedef CGAL::Cartesian<double> R; // for representation
This also reflects the new design, where the kernel classes are
kernels containing objects and predicates not just representation
classes for the objects.
The following guidelines should be followed to the greatest extent possible when writing the example and demo programs.
All programs included in the documentation should be included in either the examples or the demo directory to ensure that:
The reverse statement, that all programs in the examples and demo directory should be included in the documentation, is not necessarily true. Ideally the programs included in the documentation will be a proper (non-empty) subset of the programs included in the distribution.
We maintain a page of demo programs on the CGAL web site . For each demo on the page, we have a screen shot of the demo in action, a link to the source code, and a precompiled executable for the Windows platform.
If you have other demos you would like to add to the page (and the more here the better), you should do the following:
images/demo/<program>_big.[gif|jpg]
demo/<program>.exe
demo/<subdir>/<program>.C
where <subdir> is the name of the subdirectory in which the program
is (or will be) found in the distribution. <program> should be a
name that is self-explanatory (e.g., demo.C is a bad name here).
Requirements:
Recommendations: