1 | //STARTHEADER
|
---|
2 | // $Id: Triangulation.hh,v 1.1 2008-11-06 14:32:09 ovyn Exp $
|
---|
3 | //
|
---|
4 | // Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam
|
---|
5 | //
|
---|
6 | //----------------------------------------------------------------------
|
---|
7 | // This file is part of FastJet.
|
---|
8 | //
|
---|
9 | // FastJet is free software; you can redistribute it and/or modify
|
---|
10 | // it under the terms of the GNU General Public License as published by
|
---|
11 | // the Free Software Foundation; either version 2 of the License, or
|
---|
12 | // (at your option) any later version.
|
---|
13 | //
|
---|
14 | // The algorithms that underlie FastJet have required considerable
|
---|
15 | // development and are described in hep-ph/0512210. If you use
|
---|
16 | // FastJet as part of work towards a scientific publication, please
|
---|
17 | // include a citation to the FastJet paper.
|
---|
18 | //
|
---|
19 | // FastJet is distributed in the hope that it will be useful,
|
---|
20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
22 | // GNU General Public License for more details.
|
---|
23 | //
|
---|
24 | // You should have received a copy of the GNU General Public License
|
---|
25 | // along with FastJet; if not, write to the Free Software
|
---|
26 | // Foundation, Inc.:
|
---|
27 | // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
28 | //----------------------------------------------------------------------
|
---|
29 | //ENDHEADER
|
---|
30 |
|
---|
31 |
|
---|
32 | #ifndef DROP_CGAL // in case we do not have the code for CGAL
|
---|
33 | #ifndef __FASTJET_TRIANGULATION__
|
---|
34 | #define __FASTJET_TRIANGULATION__
|
---|
35 |
|
---|
36 | // file: examples/Triangulation_2/Voronoi.C
|
---|
37 | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
---|
38 | #include <CGAL/Delaunay_triangulation_2.h>
|
---|
39 | #include <CGAL/Triangulation_hierarchy_2.h>
|
---|
40 | #include <CGAL/Triangulation_vertex_base_with_info_2.h>
|
---|
41 | #include "fastjet/internal/base.hh"
|
---|
42 |
|
---|
43 | FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
|
---|
44 |
|
---|
45 | /// the basic geometrical kernel that lies at the base of all CGAL
|
---|
46 | /// operations
|
---|
47 | #ifdef CGAL_SIMPLE_KERNEL
|
---|
48 | struct K : CGAL::Simple_cartesian<double> {};
|
---|
49 | #else
|
---|
50 | struct K : CGAL::Exact_predicates_inexact_constructions_kernel {};
|
---|
51 | #endif // CGAL_SIMPLE_KERNEL
|
---|
52 |
|
---|
53 | // our extras to help us navigate, find distance, etc.
|
---|
54 | const int INFINITE_VERTEX=-1;
|
---|
55 | const int NEW_VERTEX=-2;
|
---|
56 | const double HUGE_DOUBLE=1e300;
|
---|
57 |
|
---|
58 | /// A class to provide an "int" with an initial value.
|
---|
59 | class InitialisedInt {
|
---|
60 | private:
|
---|
61 | int _val;
|
---|
62 | public:
|
---|
63 | inline InitialisedInt () {_val=NEW_VERTEX;};
|
---|
64 | inline InitialisedInt& operator= (int value) {_val = value; return *this;};
|
---|
65 | inline int val() const {return _val;};
|
---|
66 | };
|
---|
67 |
|
---|
68 |
|
---|
69 | // We can have triangulations with and without hierarchies -- those with
|
---|
70 | // are able to guarantee N ln N time for the construction of a large
|
---|
71 | // triangulation, whereas those without go as N^{3/2} for points
|
---|
72 | // sufficiently uniformly distributed in a plane.
|
---|
73 | //
|
---|
74 | //#define NOHIERARCHY
|
---|
75 | #ifdef NOHIERARCHY
|
---|
76 | typedef CGAL::Triangulation_vertex_base_with_info_2<InitialisedInt,K> Vb;
|
---|
77 | typedef CGAL::Triangulation_face_base_2<K> Fb;
|
---|
78 | typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
|
---|
79 | typedef CGAL::Delaunay_triangulation_2<K,Tds> Triangulation;
|
---|
80 | #else
|
---|
81 | typedef CGAL::Triangulation_vertex_base_with_info_2<InitialisedInt,K> Vbb;
|
---|
82 | typedef CGAL::Triangulation_hierarchy_vertex_base_2<Vbb> Vb;
|
---|
83 | typedef CGAL::Triangulation_face_base_2<K> Fb;
|
---|
84 | typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
|
---|
85 | typedef CGAL::Delaunay_triangulation_2<K,Tds> Dt;
|
---|
86 | typedef CGAL::Triangulation_hierarchy_2<Dt> Triangulation;
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | typedef Triangulation::Vertex_handle Vertex_handle;
|
---|
90 | typedef Triangulation::Point Point; /// CGAL Point structure
|
---|
91 | typedef Triangulation::Vertex_circulator Vertex_circulator;
|
---|
92 | typedef Triangulation::Face_circulator Face_circulator;
|
---|
93 | typedef Triangulation::Face_handle Face_handle;
|
---|
94 |
|
---|
95 |
|
---|
96 |
|
---|
97 | FASTJET_END_NAMESPACE
|
---|
98 |
|
---|
99 | #endif // __FASTJET_TRIANGULATION__
|
---|
100 | #endif // DROP_CGAL
|
---|