star.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __FIREVISION_MODELS_SCANLINES_STAR_H_
00025 #define __FIREVISION_MODELS_SCANLINES_STAR_H_
00026
00027 #include <models/scanlines/scanlinemodel.h>
00028 #include <vector>
00029 #include <map>
00030
00031 class ScanlineStar : public ScanlineModel
00032 {
00033 public:
00034 ScanlineStar(unsigned int image_width, unsigned int image_height,
00035 unsigned int center_x, unsigned int center_y,
00036 unsigned int num_rays, unsigned int radius_incr,
00037 unsigned char* yuv_mask,
00038 unsigned int dead_radius = 0, unsigned int max_radius = 0,
00039 unsigned int margin = 0);
00040
00041 virtual ~ScanlineStar();
00042
00043 fawkes::point_t operator*();
00044 fawkes::point_t * operator->();
00045 fawkes::point_t * operator++();
00046 fawkes::point_t * operator++(int);
00047
00048 void advance();
00049 bool finished();
00050 void reset();
00051 const char* get_name();
00052 unsigned int get_margin();
00053 void set_robot_pose(float x, float y, float ori);
00054 void set_pan_tilt(float pan, float tilt);
00055 void skip_current_ray();
00056 unsigned int num_rays() const;
00057 unsigned int ray_index() const;
00058 unsigned int current_radius() const;
00059 float current_angle() const;
00060 bool first_on_ray() const;
00061
00062 private:
00063 void generate_scan_points();
00064
00065 unsigned int m_image_width;
00066 unsigned int m_image_height;
00067 fawkes::point_t m_center;
00068 unsigned int m_num_rays;
00069 unsigned int m_radius_incr;
00070 unsigned int m_dead_radius;
00071 unsigned int m_max_radius;
00072 unsigned int m_margin;
00073 float m_angle_incr;
00074 unsigned char* m_mask;
00075
00076 bool m_first_on_ray;
00077 bool m_done;
00078
00079 fawkes::point_t m_current_point;
00080 fawkes::point_t m_tmp_point;
00081 unsigned int m_ray_index;
00082
00083 typedef std::map<unsigned int, fawkes::point_t> Ray;
00084 std::map<float, Ray*> m_rays;
00085 std::map<float, Ray*>::iterator m_ray_iter;
00086 Ray::iterator m_point_iter;
00087
00088
00089
00090
00091 Ray* m_first_ray;
00092 Ray* m_previous_ray;
00093 };
00094
00095 #endif