BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Arr_simple_point_location.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_simple_point_location.h $
00015 // $Id: Arr_simple_point_location.h 35622 2006-12-25 08:56:47Z wein $
00016 // 
00017 //
00018 // Author(s)     : Ron Wein   <wein@post.tau.ac.il>
00019 //                 (based on old version by Eyal Flato)
00020 #ifndef CGAL_ARR_SIMPLE_POINT_LOCATION_H
00021 #define CGAL_ARR_SIMPLE_POINT_LOCATION_H
00022 
00027 #include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
00028 
00029 CGAL_BEGIN_NAMESPACE
00030 
00037 template <class Arrangement_>
00038 class Arr_simple_point_location
00039 {
00040 public:
00041 
00042   typedef Arrangement_                                   Arrangement_2;
00043   typedef typename Arrangement_2::Geometry_traits_2      Geometry_traits_2;
00044   typedef typename Arrangement_2::Topology_traits        Topology_traits;
00045 
00046   typedef typename Arrangement_2::Vertex_const_handle    Vertex_const_handle;
00047   typedef typename Arrangement_2::Halfedge_const_handle  Halfedge_const_handle;
00048   typedef typename Arrangement_2::Face_const_handle      Face_const_handle;
00049 
00050   typedef typename Geometry_traits_2::Point_2            Point_2;
00051   typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2;
00052 
00053 protected:
00054   
00055   typedef typename Topology_traits::Dcel                 Dcel;
00056   typedef Arr_traits_basic_adaptor_2<Geometry_traits_2>  Traits_adaptor_2;
00057 
00058   // Data members:
00059   const Arrangement_2     *p_arr;        // The associated arrangement.  
00060   const Traits_adaptor_2  *geom_traits;  // Its associated geometry traits.
00061   const Topology_traits   *top_traits;   // Its associated topology traits.
00062 
00063 public:
00064 
00066   Arr_simple_point_location () : 
00067     p_arr (NULL),
00068     geom_traits (NULL),
00069     top_traits (NULL)
00070   {}
00071         
00073   Arr_simple_point_location (const Arrangement_2& arr) :
00074     p_arr (&arr)
00075   {
00076     geom_traits =
00077       static_cast<const Traits_adaptor_2*> (p_arr->geometry_traits());
00078     top_traits = p_arr->topology_traits();
00079   }
00080 
00082   void attach (const Arrangement_2& arr) 
00083   {
00084     p_arr = &arr;
00085     geom_traits =
00086       static_cast<const Traits_adaptor_2*> (p_arr->geometry_traits());
00087     top_traits = p_arr->topology_traits();
00088   }
00089 
00091   void detach ()
00092   {
00093     p_arr = NULL;
00094     geom_traits = NULL;
00095     top_traits = NULL;
00096   }
00097  
00105   Object locate (const Point_2& p) const;
00106 
00115   Object ray_shoot_up (const Point_2& p) const
00116   {
00117     return (_vertical_ray_shoot (p, true));
00118   }
00119 
00128   Object ray_shoot_down (const Point_2& p) const
00129   {
00130     return (_vertical_ray_shoot (p, false));
00131   }
00132 
00133 protected:
00134 
00144   Object _base_vertical_ray_shoot (const Point_2& p, bool shoot_up) const;
00145 
00155   Object _vertical_ray_shoot (const Point_2& p, bool shoot_up) const;
00156 
00163   Halfedge_const_handle _first_around_vertex (Vertex_const_handle v) const;
00164 
00165 };
00166 
00167 CGAL_END_NAMESPACE
00168 
00169 // The member-function definitions can be found under:
00170 #include <CGAL/Arr_point_location/Arr_simple_point_location_impl.h>
00171 
00172 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines