BWAPI
|
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_walk_along_line_point_location.h $ 00015 // $Id: Arr_walk_along_line_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 Oren Nechushtan 00020 // and Iddo Hanniel) 00021 #ifndef CGAL_ARR_WALK_ALONG_LINE_POINT_LOCATION_H 00022 #define CGAL_ARR_WALK_ALONG_LINE_POINT_LOCATION_H 00023 00028 #include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h> 00029 00030 CGAL_BEGIN_NAMESPACE 00031 00041 template <class Arrangement_> 00042 class Arr_walk_along_line_point_location 00043 { 00044 public: 00045 00046 typedef Arrangement_ Arrangement_2; 00047 typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; 00048 typedef typename Arrangement_2::Topology_traits Topology_traits; 00049 00050 typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; 00051 typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; 00052 typedef typename Arrangement_2::Face_const_handle Face_const_handle; 00053 00054 typedef typename Geometry_traits_2::Point_2 Point_2; 00055 typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; 00056 00057 protected: 00058 00059 typedef Arr_traits_basic_adaptor_2<Geometry_traits_2> Traits_adaptor_2; 00060 typedef typename Arrangement_2::Ccb_halfedge_const_circulator 00061 Ccb_halfedge_const_circulator; 00062 typedef typename Arrangement_2::Inner_ccb_const_iterator 00063 Inner_ccb_const_iterator; 00064 typedef typename Arrangement_2::Isolated_vertex_const_iterator 00065 Isolated_vertex_const_iterator; 00066 00067 // Data members: 00068 const Arrangement_2 *p_arr; // The associated arrangement. 00069 const Traits_adaptor_2 *geom_traits; // Its associated geometry traits. 00070 const Topology_traits *top_traits; // Its associated topology traits. 00071 00072 public: 00073 00075 Arr_walk_along_line_point_location () : 00076 p_arr (NULL), 00077 geom_traits (NULL), 00078 top_traits (NULL) 00079 {} 00080 00082 Arr_walk_along_line_point_location (const Arrangement_2& arr) : 00083 p_arr (&arr) 00084 { 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 attach (const Arrangement_2& arr) 00092 { 00093 p_arr = &arr; 00094 geom_traits = 00095 static_cast<const Traits_adaptor_2*> (p_arr->geometry_traits()); 00096 top_traits = p_arr->topology_traits(); 00097 } 00098 00100 void detach () 00101 { 00102 p_arr = NULL; 00103 geom_traits = NULL; 00104 top_traits = NULL; 00105 } 00106 00114 Object locate (const Point_2& p) const; 00115 00124 Object ray_shoot_up (const Point_2& p) const 00125 { 00126 return (_vertical_ray_shoot (p, true)); 00127 } 00128 00137 Object ray_shoot_down (const Point_2& p) const 00138 { 00139 return (_vertical_ray_shoot (p, false)); 00140 } 00141 00142 protected: 00143 00153 Object _vertical_ray_shoot (const Point_2& p, bool shoot_up) const; 00154 00175 bool _is_in_connected_component (const Point_2& p, 00176 Ccb_halfedge_const_circulator circ, 00177 bool shoot_up, 00178 bool inclusive, 00179 Halfedge_const_handle& closest_he, 00180 bool& is_on_edge, 00181 bool& closest_to_target) const; 00182 00192 Halfedge_const_handle _first_around_vertex (Vertex_const_handle v, 00193 bool shoot_up) const; 00194 }; 00195 00196 CGAL_END_NAMESPACE 00197 00198 // The member-function definitions can be found under: 00199 #include <CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h> 00200 00201 #endif