00001 /* Copyright (C) 2002 Dominic Letourneau (dominic.letourneau@usherbrooke.ca) 00002 00003 This library is free software; you can redistribute it and/or 00004 modify it under the terms of the GNU Lesser General Public 00005 License as published by the Free Software Foundation; either 00006 version 2.1 of the License, or (at your option) any later version. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Lesser General Public License for more details. 00012 00013 You should have received a copy of the GNU Lesser General Public 00014 License along with this library; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 */ 00017 #ifndef _CPOINT_H_ 00018 #define _CPOINT_H_ 00019 00020 #include "math.h" 00021 #include <vector> 00022 #include <list> 00023 #include <stdlib.h> 00024 #include <stdio.h> 00025 #include "Object.h" 00026 00027 namespace RobotFlow { 00028 00029 /** CPoint. 00030 00031 A Point defined by its x and y coordinates in an image 00032 00033 @author Dominic Letourneau 00034 @version $Revision: 1.5 $ 00035 \begin{verbatim} 00036 Creation : 21/02/2001 00037 Last Modification: $Date: 2005/03/29 15:20:47 $ 00038 \end{verbatim} 00039 */ 00040 class CPoint : public FD::Object{ 00041 00042 public: 00043 00044 /** 00045 Ctor with no args default (x,y) = (0,0) 00046 */ 00047 CPoint(); 00048 00049 /** 00050 Ctor with (x,y) values 00051 */ 00052 CPoint(int _x, int _y); 00053 00054 /** 00055 Operator = between two CPoint 00056 @param pt CPoint to equals 00057 @return CPoint as rvalue 00058 */ 00059 CPoint & operator = (const CPoint &pt); 00060 00061 /** 00062 Operator == between two CPoint 00063 @return bool if Cpoints are identical 00064 */ 00065 bool operator == (const CPoint &pt); 00066 00067 /** 00068 Distance between two CPoints 00069 @param pt a CPoint 00070 @return double the distance 00071 */ 00072 double dist (const CPoint &pt); 00073 00074 virtual void printOn(std::ostream &out = std::cout) const; 00075 00076 virtual void readFrom(std::istream &in); 00077 00078 public: 00079 00080 ///The x value 00081 int x; 00082 00083 ///The y value 00084 int y; 00085 }; 00086 00087 }//namespace RobotFlow 00088 00089 #endif