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
29#include <map>
30#include <vector>
31
32namespace firevision {
33
35{
36public:
37 ScanlineStar(unsigned int image_width,
38 unsigned int image_height,
39 unsigned int center_x,
40 unsigned int center_y,
41 unsigned int num_rays,
42 unsigned int radius_incr,
43 unsigned char *yuv_mask,
44 unsigned int dead_radius = 0,
45 unsigned int max_radius = 0,
46 unsigned int margin = 0);
47
48 virtual ~ScanlineStar();
49
54
55 void advance();
56 bool finished();
57 void reset();
58 const char * get_name();
59 unsigned int get_margin();
60 void set_robot_pose(float x, float y, float ori);
61 void set_pan_tilt(float pan, float tilt);
62 void skip_current_ray();
63 unsigned int num_rays() const;
64 unsigned int ray_index() const;
65 unsigned int current_radius() const;
66 float current_angle() const;
67 bool first_on_ray() const;
68
69private:
70 void generate_scan_points();
71
72 unsigned int m_image_width;
73 unsigned int m_image_height;
74 fawkes::upoint_t m_center;
75 unsigned int m_num_rays;
76 unsigned int m_radius_incr;
77 unsigned int m_dead_radius;
78 unsigned int m_max_radius;
79 unsigned int m_margin;
80 float m_angle_incr;
81 unsigned char * m_mask;
82
83 bool m_first_on_ray;
84 bool m_done;
85
86 fawkes::upoint_t m_current_point;
87 fawkes::upoint_t m_tmp_point;
88 unsigned int m_ray_index;
89
90 typedef std::map<unsigned int, fawkes::upoint_t> Ray;
91 std::map<float, Ray *> m_rays;
92 std::map<float, Ray *>::iterator m_ray_iter;
93 Ray::iterator m_point_iter;
94
95 // std::vector<float> m_angles;
96 // std::vector<float>::iterator m_angle_iter;
97
98 Ray *m_first_ray;
99 Ray *m_previous_ray;
100};
101
102} // end namespace firevision
103
104#endif /* FIREVISION_MODELS_SCANLINES_STAR_H__ */
Scanline model interface.
Definition: scanlinemodel.h:53
Star-like arranged scanline points.
Definition: star.h:35
void skip_current_ray()
Skips the current ray and continues with the first valid scanline point of the next ray.
Definition: star.cpp:204
virtual ~ScanlineStar()
Destructor.
Definition: star.cpp:96
fawkes::upoint_t operator*()
Get the current coordinate.
Definition: star.cpp:105
void set_pan_tilt(float pan, float tilt)
Set camera's pan/tilt values.
Definition: star.cpp:196
unsigned int current_radius() const
Returns the radius of the current scanline point.
Definition: star.cpp:245
void advance()
Calculates the next scanline point.
Definition: star.cpp:134
fawkes::upoint_t * operator->()
Get pointer to current point.
Definition: star.cpp:111
unsigned int ray_index() const
Return the index of the current ray.
Definition: star.cpp:236
fawkes::upoint_t * operator++()
Postfix ++ operator.
Definition: star.cpp:117
void reset()
Reset model.
Definition: star.cpp:166
const char * get_name()
Get name of scanline model.
Definition: star.cpp:178
ScanlineStar(unsigned int image_width, unsigned int image_height, unsigned int center_x, unsigned int center_y, unsigned int num_rays, unsigned int radius_incr, unsigned char *yuv_mask, unsigned int dead_radius=0, unsigned int max_radius=0, unsigned int margin=0)
Constructor.
Definition: star.cpp:55
bool first_on_ray() const
Checks whether the current scanpoint is the first scanpoint on the current ray.
Definition: star.cpp:264
void set_robot_pose(float x, float y, float ori)
Set the robot's pose.
Definition: star.cpp:190
unsigned int num_rays() const
Returns the number of segments in the model.
Definition: star.cpp:227
bool finished()
Check if all desired points have been processed.
Definition: star.cpp:160
unsigned int get_margin()
Get margin around points.
Definition: star.cpp:184
float current_angle() const
Returns the angle of the current scanline point.
Definition: star.cpp:254
Point with cartesian coordinates as unsigned integers.
Definition: types.h:35