BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Arr_geometry_traits/Conic_point_2.h
Go to the documentation of this file.
00001 // Copyright (c) 2005  Tel-Aviv University (Israel).
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/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_point_2.h $
00015 // $Id: Conic_point_2.h 33081 2006-08-07 07:46:37Z wein $
00016 // 
00017 //
00018 // Author(s)     : Ron Wein <wein@post.tau.ac.il>
00019 
00020 #ifndef CGAL_CONIC_POINT_2_H
00021 #define CGAL_CONIC_POINT_2_H
00022 
00027 #include <list>
00028 
00029 CGAL_BEGIN_NAMESPACE
00030 
00035 template <class Alg_kernel_>
00036 class _Conic_point_2 : public Alg_kernel_::Point_2
00037 {
00038 public:
00039 
00040   typedef Alg_kernel_                       Alg_kernel;
00041   typedef typename Alg_kernel::Point_2      Base;
00042   typedef _Conic_point_2<Alg_kernel>        Self;
00043     
00044   typedef typename Alg_kernel::FT           Algebraic;
00045 
00049   class Conic_id
00050   {
00051   private:
00052 
00053     unsigned int   index;           // The index of the conic arc.
00054 
00055   public:
00056 
00058     Conic_id () :
00059       index (0)
00060     {}
00061 
00063     Conic_id (unsigned int ind) :
00064       index (ind)
00065     {
00066       CGAL_precondition (ind != 0);
00067     }
00068 
00070     bool is_valid () const
00071     {
00072       return (index != 0);
00073     }
00074     
00076     bool operator== (const Conic_id& id) const
00077     {
00078       return (index == id.index);
00079     }
00080 
00082     bool operator!= (const Conic_id& id) const
00083     {
00084       return (index != id.index);
00085     }
00086 
00088     bool operator< (const Conic_id& id) const
00089     {
00090       return (index < id.index);
00091     }
00092 
00094     bool operator> (const Conic_id& id) const
00095     {
00096       return (index > id.index);
00097     }
00098   };
00099         
00100 private:
00101 
00102   typedef std::list<Conic_id>                          Ids_container;
00103   typedef typename std::list<Conic_id>::const_iterator Ids_iterator;
00104 
00105   Ids_container   conic_ids;       // The IDs of the generating conics.
00106 
00107  public:
00108 
00110 
00111 
00113   _Conic_point_2 () :
00114     Base()
00115   {}
00116 
00118   _Conic_point_2 (const Base& p) :
00119     Base (p)
00120   {}
00121 
00123   _Conic_point_2 (const Algebraic& hx, 
00124                   const Algebraic& hy,
00125                   const Algebraic& hz) :
00126     Base (hx, hy, hz)
00127   {}
00128 
00130   _Conic_point_2 (const Algebraic& x, const Algebraic& y) :
00131     Base (x, y)
00132   {}
00134 
00136 
00137 
00139   void set_generating_conic (const Conic_id& id)
00140   {
00141     if (id.is_valid())
00142       conic_ids.push_back (id);
00143 
00144     return;
00145   }
00146 
00148   bool is_generating_conic (const Conic_id& id) const
00149   {
00150     if (! id.is_valid())
00151       return (false);
00152 
00153     Ids_iterator       it;
00154 
00155     for (it = conic_ids.begin(); it != conic_ids.end(); ++it)
00156     {
00157       if (*it == id)
00158         return (true);
00159     }
00160 
00161     return (false);
00162   }
00164 
00165 };
00166 
00167 CGAL_END_NAMESPACE
00168 
00169 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines