cornerhorizon.h

00001
00002 /***************************************************************************
00003  *  cornerhorizon.h - Scanline model "shrinker", takes the corner in front
00004  *                    of the robots and calculates a "fake horizon" from this
00005  *                    and only returns the scanline points which are below
00006  *                    that very horizon
00007  *
00008  *  Generated: Fri Apr 07 04:34:08 2006
00009  *  Copyright  2005-2006  Tim Niemueller [www.niemueller.de]
00010  *             2006       Stefan Schiffer
00011  *             2006       Christoph Mies
00012  *
00013  ****************************************************************************/
00014
00015 /*  This program is free software; you can redistribute it and/or modify
00016  *  it under the terms of the GNU General Public License as published by
00017  *  the Free Software Foundation; either version 2 of the License, or
00018  *  (at your option) any later version. A runtime exception applies to
00019  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00020  *
00021  *  This program is distributed in the hope that it will be useful,
00022  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  *  GNU Library General Public License for more details.
00025  *
00026  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00027  */
00028
00029 #ifndef __FIREVISION_MODELS_SCANLINE_CORNERHORIZON_H_
00030 #define __FIREVISION_MODELS_SCANLINE_CORNERHORIZON_H_
00031 
00032 #include <models/scanlines/scanlinemodel.h>
00033 #include <fvutils/base/types.h>
00034
00035 class CornerHorizon : public ScanlineModel
00036 {
00037
00038  public:
00039
00040   CornerHorizon( ScanlineModel *model,
00041                  float field_length, float field_width, float field_border,
00042                  unsigned int image_width, unsigned int image_height,
00043                  float camera_height, float camera_ori,
00044                  float horizontal_angle, float vertical_angle
00045                  );
00046
00047   virtual ~CornerHorizon();
00048
00049   fawkes::point_t    operator*();
00050   fawkes::point_t *  operator->();
00051   fawkes::point_t *  operator++();
00052   fawkes::point_t *  operator++(int);
00053
00054   bool          finished();
00055   void          reset();
00056   const char *  get_name();
00057   unsigned int  get_margin();
00058
00059   void set_robot_pose(float x, float y, float ori);
00060   void set_pan_tilt(float pan, float tilt);
00061
00062   unsigned int getHorizon();
00063
00064  protected:
00065   void calculate();
00066
00067  private:
00068   ScanlineModel *model;
00069
00070   bool calculated;
00071
00072   float field_length;
00073   float field_width;
00074   float field_border;
00075
00076   float pose_x;
00077   float pose_y;
00078   float pose_ori;
00079
00080   float pan;
00081   float tilt;
00082
00083   unsigned int image_width;
00084   unsigned int image_height;
00085
00086   float camera_height;
00087   float camera_ori;
00088
00089   float horizontal_angle;
00090   float vertical_angle;
00091
00092   float pan_pixel_per_rad;
00093   float tilt_pixel_per_rad;
00094
00095   fawkes::point_t coord;
00096   fawkes::point_t tmp_coord;
00097
00098   unsigned int horizon;
00099
00100   static const float M_PI_HALF;
00101
00102 };
00103
00104 #endif