Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Representations/Perception/LinesPercept.h

Go to the documentation of this file.
00001 /**
00002  * @file LinesPercept.h
00003  * 
00004  * Declaration of class LinesPercept
00005  * @author <A href=mailto:juengel@informatik.hu-berlin.de>Matthias Juengel</A>
00006  */ 
00007 
00008 #ifndef __LinesPercept_h_
00009 #define __LinesPercept_h_
00010 
00011 
00012 #include "Tools/Streams/InOut.h"
00013 #include "Tools/Math/Vector2.h"
00014 
00015 /**
00016 * The class represents a percepted line on the field with its type and a Vector of points belonging to it.
00017 */
00018 class LinesPercept
00019 {
00020   public:
00021     enum LineType
00022     {
00023       field,
00024       border,
00025       yellowGoal, 
00026       skyblueGoal,
00027 //      sideOfPenaltyArea,
00028       numberOfLineTypes,
00029       redRobot = numberOfLineTypes,
00030       blueRobot,
00031       ball,
00032       numberOfTypes,
00033       xField = ball,
00034       yField
00035     }; /**< Defines the different kinds of lines. */
00036 
00037     enum {UNDEF = -4};
00038 
00039     class LinePoint : public Vector2<int>
00040     {
00041     public:
00042       double angle;
00043 
00044       LinePoint() {angle = UNDEF;}
00045       LinePoint(const Vector2<int>& v, double angle = UNDEF) 
00046       {
00047         x = v.x; 
00048         y = v.y; 
00049         this->angle = angle;
00050       }
00051 
00052       LinePoint& operator=(Vector2<int>& v) 
00053       {
00054         x = v.x; 
00055         y = v.y; 
00056         angle = UNDEF; 
00057         return *this;
00058       }
00059 
00060     };
00061 
00062     enum {maxNumberOfPoints = 200}; /**< Specifies the maximum number of points per line type. */
00063 
00064     LinePoint points[numberOfTypes][maxNumberOfPoints]; /**< The points on lines. */
00065     int numberOfPoints[numberOfTypes]; /**< The number of points per line type. */
00066     unsigned long frameNumber; /**< The frame number when perceived. */
00067     /**
00068      * Constructor.
00069      */
00070     LinesPercept() {reset(0);}
00071 
00072     /**
00073      * The function empties the line percept.
00074      */
00075     void reset(unsigned long frameNumber);
00076 
00077     /**
00078      * The function adds a new point to the lines percept.
00079      * @param type The line type of the point.
00080    * @param angle the angle
00081      * @param point The point.
00082      * @param angle The angle.
00083      */
00084     void add(LineType type,const Vector2<int>& point, double angle = UNDEF);
00085 };
00086 
00087 /**
00088  * Streaming operator that reads a LinesPercept from a stream.
00089  * @param stream The stream from which is read.
00090  * @param linesPercept The LinesPercept object.
00091  * @return The stream.
00092  */ 
00093 In& operator>>(In& stream,LinesPercept& linesPercept);
00094  
00095 /**
00096  * Streaming operator that writes a LinesPercept to a stream.
00097  * @param stream The stream to write on.
00098  * @param linesPercept The LinesPercept object.
00099  * @return The stream.
00100  */ 
00101 Out& operator<<(Out& stream, const LinesPercept& linesPercept);
00102 
00103 
00104 #endif //__LinesPercept_h_
00105 
00106 /*
00107  * Change log :
00108  * 
00109  * $Log: LinesPercept.h,v $
00110  * Revision 1.5  2004/09/09 11:37:39  wachter
00111  * - Fixed some more doxygen-errors
00112  *
00113  * Revision 1.4  2004/09/09 10:15:58  spranger
00114  * fixed doxygen-errors
00115  *
00116  * Revision 1.3  2004/06/24 18:26:38  roefer
00117  * Lines table redesign, should not influence the performance of GT2003SL
00118  *
00119  * Revision 1.2  2004/06/16 18:58:40  roefer
00120  * LinesPercept with angles, does not work yet
00121  *
00122  * Revision 1.1.1.1  2004/05/22 17:25:51  cvsadm
00123  * created new repository GT2004_WM
00124  *
00125  * Revision 1.3  2004/01/19 14:53:46  dueffert
00126  * all frameNumbers (and not only some of them) are unsigned long now
00127  *
00128  * Revision 1.2  2003/11/12 16:19:35  goehring
00129  * frameNumber added to percepts
00130  *
00131  * Revision 1.1  2003/10/07 10:09:36  cvsadm
00132  * Created GT2004 (M.J.)
00133  *
00134  * Revision 1.2  2003/09/25 11:23:52  juengel
00135  * Removed BlobCollection.
00136  *
00137  * Revision 1.1.1.1  2003/07/02 09:40:22  cvsadm
00138  * created new repository for the competitions in Padova from the 
00139  * tamara CVS (Tuesday 2:00 pm)
00140  *
00141  * removed unused solutions
00142  *
00143  * Revision 1.8  2003/03/22 11:06:25  roefer
00144  * Progress in LinesImageProcessor2
00145  *
00146  * Revision 1.7  2003/03/10 13:53:11  juengel
00147  * Prepared new type sideOfPenaltyArea
00148  *
00149  * Revision 1.6  2002/12/04 12:20:37  juengel
00150  * Changed the data type of the points in the LinesPercept from Vector2<double> to Vector2<int>.
00151  *
00152  * Revision 1.5  2002/11/27 13:54:07  dueffert
00153  * doxygen docu added
00154  *
00155  * Revision 1.4  2002/09/22 18:40:50  risler
00156  * added new math functions, removed GTMath library
00157  *
00158  * Revision 1.3  2002/09/19 12:05:49  loetzsch
00159  * MathLib -> Mathlib
00160  *
00161  * Revision 1.2  2002/09/17 23:55:20  loetzsch
00162  * - unraveled several datatypes
00163  * - changed the WATCH macro
00164  * - completed the process restructuring
00165  *
00166  * Revision 1.1  2002/09/10 15:26:40  cvsadm
00167  * Created new project GT2003 (M.L.)
00168  * - Cleaned up the /Src/DataTypes directory
00169  * - Removed Challenge Code
00170  * - Removed processing of incoming audio data
00171  * - Renamed AcousticMessage to SoundRequest
00172  *
00173  * Revision 1.4  2002/07/23 13:32:57  loetzsch
00174  * new streaming classes
00175  *
00176  * removed many #include statements
00177  *
00178  * Revision 1.3  2002/06/12 11:34:53  roefer
00179  * Improvements in LinesSelfLocator
00180  *
00181  * Revision 1.2  2002/06/02 23:21:08  roefer
00182  * Single color table and progress in LinesSelfLocator
00183  *
00184  * Revision 1.1.1.1  2002/05/10 12:40:13  cvsadm
00185  * Moved GT2002 Project from ute to tamara.
00186  *
00187  * Revision 1.5  2002/04/02 13:10:18  dueffert
00188  * big change: odometryData and cameraMatrix in image now, old logfiles may be obsolete
00189  *
00190  * Revision 1.4  2002/03/24 17:47:02  juengel
00191  * LinesPercept defined and LinesPerceptor added.
00192  *
00193  * Revision 1.3  2001/12/10 17:47:06  risler
00194  * change log added
00195  *
00196  */

Generated on Thu Sep 23 19:57:36 2004 for GT2004 by doxygen 1.3.6