Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * star.h - Starlike scanline model 00004 * 00005 * Created: Mon Nov 05 09:45:06 2007 00006 * Copyright 2007 Daniel Beck 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __FIREVISION_MODELS_SCANLINES_STAR_H_ 00025 #define __FIREVISION_MODELS_SCANLINES_STAR_H_ 00026 00027 #include <fvmodels/scanlines/scanlinemodel.h> 00028 #include <vector> 00029 #include <map> 00030 00031 namespace firevision { 00032 #if 0 /* just to make Emacs auto-indent happy */ 00033 } 00034 #endif 00035 00036 class ScanlineStar : public ScanlineModel 00037 { 00038 public: 00039 ScanlineStar(unsigned int image_width, unsigned int image_height, 00040 unsigned int center_x, unsigned int center_y, 00041 unsigned int num_rays, unsigned int radius_incr, 00042 unsigned char* yuv_mask, 00043 unsigned int dead_radius = 0, unsigned int max_radius = 0, 00044 unsigned int margin = 0); 00045 00046 virtual ~ScanlineStar(); 00047 00048 fawkes::point_t operator*(); 00049 fawkes::point_t * operator->(); 00050 fawkes::point_t * operator++(); 00051 fawkes::point_t * operator++(int); 00052 00053 void advance(); 00054 bool finished(); 00055 void reset(); 00056 const char* get_name(); 00057 unsigned int get_margin(); 00058 void set_robot_pose(float x, float y, float ori); 00059 void set_pan_tilt(float pan, float tilt); 00060 void skip_current_ray(); 00061 unsigned int num_rays() const; 00062 unsigned int ray_index() const; 00063 unsigned int current_radius() const; 00064 float current_angle() const; 00065 bool first_on_ray() const; 00066 00067 private: 00068 void generate_scan_points(); 00069 00070 unsigned int m_image_width; 00071 unsigned int m_image_height; 00072 fawkes::point_t m_center; 00073 unsigned int m_num_rays; 00074 unsigned int m_radius_incr; 00075 unsigned int m_dead_radius; 00076 unsigned int m_max_radius; 00077 unsigned int m_margin; 00078 float m_angle_incr; 00079 unsigned char* m_mask; 00080 00081 bool m_first_on_ray; 00082 bool m_done; 00083 00084 fawkes::point_t m_current_point; 00085 fawkes::point_t m_tmp_point; 00086 unsigned int m_ray_index; 00087 00088 typedef std::map<unsigned int, fawkes::point_t> Ray; 00089 std::map<float, Ray*> m_rays; 00090 std::map<float, Ray*>::iterator m_ray_iter; 00091 Ray::iterator m_point_iter; 00092 00093 // std::vector<float> m_angles; 00094 // std::vector<float>::iterator m_angle_iter; 00095 00096 Ray* m_first_ray; 00097 Ray* m_previous_ray; 00098 }; 00099 00100 } // end namespace firevision 00101 00102 #endif /* __FIREVISION_MODELS_SCANLINES_STAR_H_ */