star.h

00001
00002 /***************************************************************************
00003  *  star.h - Starlike scanline model
00004  *
00005  *  Generated: 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 <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   //  std::vector<float> m_angles;
00089   //  std::vector<float>::iterator m_angle_iter;
00090
00091   Ray* m_first_ray;
00092   Ray* m_previous_ray;
00093 };
00094
00095 #endif /* __FIREVISION_MODELS_SCANLINES_STAR_H_ */