BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Triangulation_face_base_2.h
Go to the documentation of this file.
00001 // Copyright (c) 1997  INRIA Sophia-Antipolis (France).
00002 // All rights reserved.
00003 //
00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under
00005 // the terms of the Q Public License version 1.0.
00006 // See the file LICENSE.QPL distributed with CGAL.
00007 //
00008 // Licensees holding a valid commercial license may use this file in
00009 // accordance with the commercial license agreement provided with the software.
00010 //
00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 //
00014 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Triangulation_2/include/CGAL/Triangulation_face_base_2.h $
00015 // $Id: Triangulation_face_base_2.h 48844 2009-04-21 18:28:04Z spion $
00016 // 
00017 //
00018 // Author(s)     : Mariette Yvinec
00019 
00020 #ifndef CGAL_TRIANGULATION_FACE_BASE_2_H
00021 #define CGAL_TRIANGULATION_FACE_BASE_2_H
00022 
00023 #include <CGAL/basic.h>
00024 #include <CGAL/triangulation_assertions.h>
00025 #include <CGAL/Triangulation_ds_face_base_2.h>
00026 
00027 CGAL_BEGIN_NAMESPACE 
00028 
00029 template < typename Gt, typename Fb = Triangulation_ds_face_base_2<> >
00030 class Triangulation_face_base_2 
00031   : public Fb
00032 {
00033 public:
00034   typedef Gt                                           Geom_traits;
00035   typedef typename Fb::Vertex_handle                   Vertex_handle;
00036   typedef typename Fb::Face_handle                     Face_handle;
00037 
00038   template < typename TDS2 >
00039   struct Rebind_TDS {
00040     typedef typename Fb::template Rebind_TDS<TDS2>::Other  Fb2;
00041     typedef Triangulation_face_base_2<Gt, Fb2>             Other;
00042   };
00043 
00044 public:
00045   Triangulation_face_base_2()
00046        : Fb() {}
00047 
00048   Triangulation_face_base_2(Vertex_handle v0, 
00049                             Vertex_handle v1, 
00050                             Vertex_handle v2)
00051     : Fb(v0,v1,v2) {}
00052 
00053   Triangulation_face_base_2(Vertex_handle v0, 
00054                             Vertex_handle v1, 
00055                             Vertex_handle v2,
00056                             Face_handle n0, 
00057                             Face_handle n1, 
00058                             Face_handle n2)
00059     : Fb(v0,v1,v2,n0,n1,n2) {}
00060 
00061   static int ccw(int i) {return Triangulation_cw_ccw_2::ccw(i);}
00062   static int  cw(int i) {return Triangulation_cw_ccw_2::cw(i);}
00063 
00064 #ifndef CGAL_NO_DEPRECATED_CODE
00065   Vertex_handle mirror_vertex(int i) const;
00066   int mirror_index(int i) const;
00067 #endif
00068 
00069 };
00070 
00071 #ifndef CGAL_NO_DEPRECATED_CODE
00072 template < class Gt, class Fb >
00073 inline
00074 typename Triangulation_face_base_2<Gt,Fb>::Vertex_handle
00075 Triangulation_face_base_2<Gt,Fb>::
00076 mirror_vertex(int i) const
00077 {
00078   CGAL_triangulation_precondition ( this->neighbor(i) != Face_handle()
00079                                     && this->dimension() >= 1);
00080   //return neighbor(i)->vertex(neighbor(i)->index(this->handle()));
00081   return this->neighbor(i)->vertex(mirror_index(i));
00082 }
00083 
00084 template < class Gt, class Fb >
00085 inline int
00086 Triangulation_face_base_2<Gt,Fb>::
00087 mirror_index(int i) const
00088 {
00089   // return the index of opposite vertex in neighbor(i);
00090   CGAL_triangulation_precondition (this->neighbor(i) != Face_handle() &&
00091                                    this->dimension() >= 1);
00092   if (this->dimension() == 1) {
00093     return 1 - (this->neighbor(i)->index(this->vertex(1-i)));
00094   }
00095   return this->ccw( this->neighbor(i)->index(this->vertex(this->ccw(i))));
00096 }
00097 #endif
00098 
00099 CGAL_END_NAMESPACE 
00100 
00101 #endif //CGAL_TRIANGULATION_FACE_BASE_2_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines