beams.h

00001
00002 /***************************************************************************
00003  *  beams.h - Scanline model implementation: beams
00004  *
00005  *  Created: Tue Apr 17 20:59:58 2007
00006  *  Copyright  2005-2007  Tim Niemueller [www.niemueller.de]
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_SCANLINE_BEAMS_H_
00025 #define __FIREVISION_SCANLINE_BEAMS_H_
00026 
00027 #include <models/scanlines/scanlinemodel.h>
00028 #include <fvutils/base/types.h>
00029
00030 #include <vector>
00031
00032 class ScanlineBeams : public ScanlineModel
00033 {
00034
00035  public:
00036
00037   ScanlineBeams(unsigned int image_width, unsigned int image_height,
00038                 unsigned int start_x, unsigned int start_y,
00039                 unsigned int stop_y, unsigned int offset_y,
00040                 bool distribute_start_x,
00041                 float angle_from, float angle_range, unsigned int num_beams);
00042
00043   fawkes::point_t    operator*();
00044   fawkes::point_t *  operator->();
00045   fawkes::point_t *  operator++();
00046   fawkes::point_t *  operator++(int);
00047
00048   bool          finished();
00049   void          reset();
00050   const char *  get_name();
00051   unsigned int  get_margin();
00052
00053   virtual void  set_robot_pose(float x, float y, float ori) {}
00054   virtual void  set_pan_tilt(float pan, float tilt) {}
00055
00056  private:
00057   void advance();
00058
00059
00060   bool _finished;
00061
00062   std::vector<fawkes::point_t> beam_current_pos;
00063   std::vector<fawkes::point_t> beam_end_pos;
00064
00065   unsigned int start_x;
00066   unsigned int start_y;
00067   float angle_from;
00068   float angle_range;
00069   unsigned int num_beams;
00070   unsigned int stop_y;
00071   unsigned int offset_y;
00072   unsigned int image_width;
00073   unsigned int image_height;
00074   bool distribute_start_x;
00075
00076   fawkes::point_t coord;
00077   fawkes::point_t tmp_coord;
00078
00079   unsigned int next_beam;
00080   unsigned int first_beam;
00081   unsigned int last_beam;
00082 };
00083
00084 #endif