Fawkes API  Fawkes Development Version
star.h
1 
2 /***************************************************************************
3  * star.h - Starlike scanline model
4  *
5  * Created: Mon Nov 05 09:45:06 2007
6  * Copyright 2007 Daniel Beck
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __FIREVISION_MODELS_SCANLINES_STAR_H_
25 #define __FIREVISION_MODELS_SCANLINES_STAR_H_
26 
27 #include <fvmodels/scanlines/scanlinemodel.h>
28 #include <vector>
29 #include <map>
30 
31 namespace firevision {
32 #if 0 /* just to make Emacs auto-indent happy */
33 }
34 #endif
35 
37 {
38  public:
39  ScanlineStar(unsigned int image_width, unsigned int image_height,
40  unsigned int center_x, unsigned int center_y,
41  unsigned int num_rays, unsigned int radius_incr,
42  unsigned char* yuv_mask,
43  unsigned int dead_radius = 0, unsigned int max_radius = 0,
44  unsigned int margin = 0);
45 
46  virtual ~ScanlineStar();
47 
48  fawkes::point_t operator*();
49  fawkes::point_t * operator->();
50  fawkes::point_t * operator++();
51  fawkes::point_t * operator++(int);
52 
53  void advance();
54  bool finished();
55  void reset();
56  const char* get_name();
57  unsigned int get_margin();
58  void set_robot_pose(float x, float y, float ori);
59  void set_pan_tilt(float pan, float tilt);
60  void skip_current_ray();
61  unsigned int num_rays() const;
62  unsigned int ray_index() const;
63  unsigned int current_radius() const;
64  float current_angle() const;
65  bool first_on_ray() const;
66 
67  private:
68  void generate_scan_points();
69 
70  unsigned int m_image_width;
71  unsigned int m_image_height;
72  fawkes::point_t m_center;
73  unsigned int m_num_rays;
74  unsigned int m_radius_incr;
75  unsigned int m_dead_radius;
76  unsigned int m_max_radius;
77  unsigned int m_margin;
78  float m_angle_incr;
79  unsigned char* m_mask;
80 
81  bool m_first_on_ray;
82  bool m_done;
83 
84  fawkes::point_t m_current_point;
85  fawkes::point_t m_tmp_point;
86  unsigned int m_ray_index;
87 
88  typedef std::map<unsigned int, fawkes::point_t> Ray;
89  std::map<float, Ray*> m_rays;
90  std::map<float, Ray*>::iterator m_ray_iter;
91  Ray::iterator m_point_iter;
92 
93  // std::vector<float> m_angles;
94  // std::vector<float>::iterator m_angle_iter;
95 
96  Ray* m_first_ray;
97  Ray* m_previous_ray;
98 };
99 
100 } // end namespace firevision
101 
102 #endif /* __FIREVISION_MODELS_SCANLINES_STAR_H_ */
Scanline model interface.
Definition: scanlinemodel.h:55
Point with cartesian coordinates as unsigned integers.
Definition: types.h:34
Star-like arranged scanline points.
Definition: star.h:36