ZoneOps.h
Go to the documentation of this file.
00001 #ifndef __ZONEOPS_H__
00002 #define __ZONEOPS_H__
00003 
00004 #include <vector>
00005 
00006 #include <art_map/coordinates.h>
00007 #include <art_map/Graph.h>
00008 #include <art_map/RNDF.h>
00009 #include <art_map/zones.h>
00010 
00011 //#include <art/evg-thin.h>
00012 //#include <art/datatypes.h>
00013 
00014 class ZoneManager {
00015 public:
00016   ZoneManager(const ZonePerimeter &_zone,
00017               float _safety_radius,
00018               float _scale,
00019               int _max_cells,
00020               bool _write_graph,
00021               ElementID _starting_id,
00022               MapXY _lower_left,
00023               MapXY _upper_right);
00024 
00025   void build_graph(const ObstacleList &obstacles,
00026                    const MapXY &start);
00027 
00028   WayPointNodeList path_through_zone(const ObstacleList &obstacles,
00029                                      MapXY start,
00030                                      MapXY end);
00031   ElementID starting_id;
00032 private:
00033   bool write_graph;
00034   ZonePerimeter zone;
00035   float safety_radius;
00036   MapXY ll;
00037   MapXY ur;
00038   float scale;
00039 #if 0 // skip EVG thin stuff
00040   grid_manager gmanager;
00041   evg_thin thin;
00042 #endif // skip EVG thin stuff
00043 
00044   WayPointNodeList nodes;
00045   WayPointEdgeList edges;
00046 
00047   std::vector<MapXY> perimeter_points;
00048 };
00049 
00050 namespace ZoneOps {
00051   WayPointNodeList path_through_zone(const ZonePerimeter &zone,
00052                                      float perimeter_sample,
00053                                      float safety_radius,
00054                                      const ObstacleList &obstacles,
00055                                      MapXY start,
00056                                      MapXY end,
00057                                      bool write_graph,
00058                                      bool write_poly,
00059                                      bool write_obstacles,
00060                                      float scale,
00061                                      int max_cells);
00062   
00063   segment_id_t containing_zone(const ZonePerimeterList &zones,
00064                                const MapXY &point);
00065 
00066   bool point_in_zone(const ZonePerimeter &zone,
00067                      const MapXY &point);
00068 
00069   ZonePerimeter get_zone_by_id(const ZonePerimeterList &zones,
00070                                const segment_id_t &zone_id);
00071 
00072   bool is_a_zone_id(const ZonePerimeterList &zones,
00073                     const segment_id_t &zone_id);
00074 
00075   WayPointNode starting_node_for_zone(const ZonePerimeter &zone);
00076 
00077   ZonePerimeter build_fake_zone(const std::vector<MapXY> &points_to_include,
00078                                 float border_width);
00079 
00080 
00081   ZonePerimeterList build_zone_list_from_rndf(RNDF &rndf,
00082                                               Graph &graph);
00083 
00084 #if 0 // maybe later
00085   /* ------------ Functions primarily for internal use ------ */
00086   ObstacleList filter_obstacles(const ObstacleList &obstacles,
00087                                 const ZonePerimeter &zone);
00088 
00089   void expand_bounding_box(const std::vector<MapXY> &points_to_include,
00090                    MapXY &lower_left,
00091                    MapXY &upper_right);
00092 
00093   void expand_bounding_box_of_waypoints(const std::vector<WayPointNode>
00094                                         &points_to_include,
00095                                         MapXY &lower_left,
00096                                         MapXY &upper_right);
00097   
00098   void correct_edge_distances(Graph& g);
00099 
00100   int voronoi_from_evg_thin(WayPointNodeList &nodes,
00101                             WayPointEdgeList &edges,
00102                             const ZonePerimeter &zone,
00103                             float safety_radius,
00104                             const ObstacleList &obstacles,
00105                             const MapXY &start,
00106                             bool write_graph,
00107                             bool write_image,
00108                             float scale,
00109                             int max_cells);
00110   
00111   int voronoi_from_trilibrary(WayPointNodeList &nodes,
00112                               WayPointEdgeList &edges,
00113                               const ZonePerimeter &zone,
00114                               float perimeter_sample,
00115                               float safety_radius,
00116                               const ObstacleList &obstacles,
00117                               bool write_graph,
00118                               bool write_poly,
00119                               bool write_obstacles);
00120 #endif // maybe later
00121 
00122   int filter_nodes_and_edges(WayPointNodeList &nodes,
00123                              WayPointEdgeList &edges,
00124                              float safety_radius);
00125 
00126   void print_zone_list(const ZonePerimeterList &zones);
00127 
00128   void print_zone(const ZonePerimeter &zone);
00129 
00130   void print_tio(const struct triangulateio &t);
00131 
00132   void print_graph_as_voronoi(Graph &graph);
00133 
00134   void add_densely(std::vector<MapXY> &points,
00135                    const MapXY &p1,
00136                    const MapXY &p2,
00137                    const float &max_spacing);
00138   
00139   void populate_triangulateio(struct triangulateio &t,
00140                               const ZonePerimeter &zone,
00141                               const ObstacleList &obstacles,
00142                               const float &max_spacing,
00143                               bool write_obstacles);
00144 
00145   void add_new_node(const struct triangulateio &t,
00146                     const int &i,
00147                     int &index,
00148                     std::vector<WayPointNode> &nodes,
00149                     std::map<int,WayPointNode> &original_node_index);
00150 
00151   // Must delete after calling this!
00152   void build_new_graph(const WayPointNodeList &nodes,
00153                        const WayPointEdgeList &edges,
00154                        Graph& g);
00155 
00156   ZonePerimeter build_zone_perimeter_from_zone(Graph &graph,
00157                                                Zone &zone);
00158 
00159   int intersections_of_segment_and_ray_to_right(const MapXY &p1,
00160                                                 const MapXY &p2,
00161                                                 const MapXY &p3,
00162                                                 const MapXY &r);
00163 };
00164 
00165 #endif /* __ZONEOPS_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


art_map
Author(s): David Li, Patrick Beeson, Bartley Gillen, Tarun Nimmagadda, Mickey Ristroph, Michael Quinlan, Jack O'Quin
autogenerated on Tue Sep 24 2013 10:41:51