00001 /** 00002 * @file EdgesPercept.h 00003 * 00004 * Declaration of class EdgesPercept 00005 * @author Dirk Thomas 00006 */ 00007 00008 #ifndef __EdgesPercept_h_ 00009 #define __EdgesPercept_h_ 00010 00011 00012 #include "Tools/Streams/InOut.h" 00013 #include "Tools/Math/Vector2.h" 00014 00015 /** 00016 * The class represents a percepted edge on the field. 00017 */ 00018 class EdgesPercept 00019 { 00020 public: 00021 enum {maxNumberOfEdges = 50}; /**< Specifies the maximum number of edges. */ 00022 00023 struct Edge 00024 { 00025 Vector2<int> point1; 00026 Vector2<int> point2; 00027 }; 00028 00029 Edge edges[maxNumberOfEdges]; /**< The edges. */ 00030 int numberOfEdges; /**< The number of edges. */ 00031 unsigned long frameNumber; /**< The frame number when perceived. */ 00032 00033 /** 00034 * Constructor. 00035 */ 00036 EdgesPercept() {reset(0);} 00037 00038 /** 00039 * The function empties the edge percept. 00040 */ 00041 void reset(unsigned long frameNumber); 00042 00043 /** 00044 * The function adds a new edge to the edge percept. 00045 * @param point1 The point on one end of the edge. 00046 * @param point2 The point on the other end of the edge. 00047 */ 00048 void add(const Vector2<int>& point1, const Vector2<int>& point2); 00049 }; 00050 00051 /** 00052 * Streaming operator that reads a EdgesPercept from a stream. 00053 * @param stream The stream from which is read. 00054 * @param EdgesPercept The EdgesPercept object. 00055 * @return The stream. 00056 */ 00057 In& operator>>(In& stream,EdgesPercept& EdgesPercept); 00058 00059 /** 00060 * Streaming operator that writes a EdgesPercept to a stream. 00061 * @param stream The stream to write on. 00062 * @param EdgesPercept The EdgesPercept object. 00063 * @return The stream. 00064 */ 00065 Out& operator<<(Out& stream, const EdgesPercept& EdgesPercept); 00066 00067 00068 #endif //__EdgesPercept_h_ 00069 00070 /* 00071 * Change log : 00072 * 00073 * $Log: EdgesPercept.h,v $ 00074 * Revision 1.1 2004/06/15 12:11:35 thomas 00075 * added missing files for edges-percept 00076 * 00077 * 00078 */