FastJet 3.0beta1
Triangulation.hh
00001 //STARTHEADER
00002 // $Id: Triangulation.hh 1761 2010-09-16 10:43:18Z soyez $
00003 //
00004 // Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam
00005 //
00006 //----------------------------------------------------------------------
00007 // This file is part of FastJet.
00008 //
00009 //  FastJet is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU General Public License as published by
00011 //  the Free Software Foundation; either version 2 of the License, or
00012 //  (at your option) any later version.
00013 //
00014 //  The algorithms that underlie FastJet have required considerable
00015 //  development and are described in hep-ph/0512210. If you use
00016 //  FastJet as part of work towards a scientific publication, please
00017 //  include a citation to the FastJet paper.
00018 //
00019 //  FastJet is distributed in the hope that it will be useful,
00020 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 //  GNU General Public License for more details.
00023 //
00024 //  You should have received a copy of the GNU General Public License
00025 //  along with FastJet; if not, write to the Free Software
00026 //  Foundation, Inc.:
00027 //      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //----------------------------------------------------------------------
00029 //ENDHEADER
00030 
00031 
00032 #ifndef DROP_CGAL // in case we do not have the code for CGAL
00033 #ifndef __FASTJET_TRIANGULATION__
00034 #define __FASTJET_TRIANGULATION__
00035 
00036 // file: examples/Triangulation_2/Voronoi.C
00037 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
00038 #include <CGAL/Delaunay_triangulation_2.h>
00039 #include <CGAL/Triangulation_hierarchy_2.h>
00040 #include <CGAL/Triangulation_vertex_base_with_info_2.h>
00041 #include "fastjet/internal/base.hh"
00042 
00043 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00044 
00045 /// \if internal_doc
00046 /// @ingroup internal
00047 /// \struct K
00048 /// the basic geometrical kernel that lies at the base of all CGAL
00049 /// operations
00050 /// \endif
00051 #ifdef CGAL_SIMPLE_KERNEL
00052 struct K : CGAL::Simple_cartesian<double> {};
00053 #else
00054 struct K : CGAL::Exact_predicates_inexact_constructions_kernel {};
00055 #endif // CGAL_SIMPLE_KERNEL
00056 
00057 // our extras to help us navigate, find distance, etc.
00058 const int INFINITE_VERTEX=-1;
00059 const int NEW_VERTEX=-2;
00060 const double HUGE_DOUBLE=1e300;
00061 
00062 /// \if internal_doc
00063 /// @ingroup internal
00064 /// \struct InitialisedInt
00065 /// A class to provide an "int" with an initial value.
00066 /// \endif
00067 class InitialisedInt {
00068  private:
00069   int _val;
00070  public:
00071   inline InitialisedInt () {_val=NEW_VERTEX;};
00072   inline InitialisedInt& operator= (int value) {_val = value; return *this;};
00073   inline int val() const {return _val;};
00074 };
00075 
00076 
00077 // We can have triangulations with and without hierarchies -- those with 
00078 // are able to guarantee N ln N time for the construction of a large
00079 // triangulation, whereas those without go as N^{3/2} for points
00080 // sufficiently uniformly distributed in a plane.
00081 //
00082 //#define NOHIERARCHY
00083 #ifdef NOHIERARCHY
00084 typedef CGAL::Triangulation_vertex_base_with_info_2<InitialisedInt,K> Vb;
00085 typedef CGAL::Triangulation_face_base_2<K> Fb;
00086 typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
00087 typedef CGAL::Delaunay_triangulation_2<K,Tds>  Triangulation;
00088 #else
00089 typedef CGAL::Triangulation_vertex_base_with_info_2<InitialisedInt,K> Vbb;
00090 typedef CGAL::Triangulation_hierarchy_vertex_base_2<Vbb> Vb;
00091 typedef CGAL::Triangulation_face_base_2<K> Fb;
00092 typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
00093 typedef CGAL::Delaunay_triangulation_2<K,Tds>  Dt;
00094 typedef CGAL::Triangulation_hierarchy_2<Dt> Triangulation;
00095 #endif
00096 
00097 typedef Triangulation::Vertex_handle  Vertex_handle;
00098 typedef Triangulation::Point          Point; /// CGAL Point structure
00099 typedef Triangulation::Vertex_circulator Vertex_circulator;
00100 typedef Triangulation::Face_circulator Face_circulator;
00101 typedef Triangulation::Face_handle Face_handle;
00102 
00103 
00104 
00105 FASTJET_END_NAMESPACE
00106 
00107 #endif // __FASTJET_TRIANGULATION__
00108 #endif //  DROP_CGAL 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends