Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

plpoint.h

00001 /*
00002 /--------------------------------------------------------------------
00003 |
00004 |      $Id: plpoint.h,v 1.8 2002/03/31 13:36:42 uzadow Exp $
00005 |
00006 |      Copyright (c) 1996-2002 Ulrich von Zadow
00007 |
00008 \--------------------------------------------------------------------
00009 */
00010 
00011 #ifndef INCL_PLPOINT
00012 #define INCL_PLPOINT
00013 
00014 //! Simple point class for 2d integer coordinate manipulations. This class
00015 //! contains only inline functions and nothing virtual. Its member variables
00016 //! are public.
00017 class PLPoint
00018 {
00019 public:
00020   //!
00021   int x;
00022   //! 
00023   int y;
00024 
00025   //!
00026   PLPoint
00027   ();
00028 
00029   //!
00030   PLPoint
00031   ( int X,
00032     int Y
00033   );
00034 
00035   //!
00036   bool operator ==
00037   ( const PLPoint & pt
00038   ) const;
00039 
00040   //!
00041   bool operator !=
00042   ( const PLPoint & pt
00043   ) const;
00044 
00045   //!
00046   void operator +=
00047   ( const PLPoint & pt
00048   );
00049 
00050   //!
00051   void operator -=
00052   ( const PLPoint & pt
00053   );
00054 
00055   //!
00056   PLPoint operator -
00057   () const;
00058 
00059   //!
00060   PLPoint operator +
00061   ( const PLPoint & pt
00062   ) const;
00063 
00064   //!
00065   PLPoint operator -
00066   ( const PLPoint & pt
00067   ) const;
00068 
00069   //!
00070   PLPoint operator /
00071   ( double f
00072   ) const;
00073 };
00074 
00075 inline PLPoint::PLPoint
00076 ()
00077 {}
00078 
00079 
00080 inline PLPoint::PLPoint
00081 ( int X,
00082   int Y
00083 )
00084 {
00085   x = X;
00086   y = Y;
00087 }
00088 
00089 inline bool PLPoint::operator ==
00090 ( const PLPoint & pt
00091 ) const
00092 {
00093   return (x == pt.x && y == pt.y);
00094 }
00095 
00096 inline bool PLPoint::operator !=
00097 ( const PLPoint & pt
00098 ) const
00099 {
00100   return (x != pt.x || y != pt.y);
00101 }
00102 
00103 inline void PLPoint::operator +=
00104 ( const PLPoint & pt
00105 )
00106 {
00107   x += pt.x;
00108   y += pt.y;
00109 }
00110 
00111 inline void PLPoint::operator -=
00112 ( const PLPoint & pt
00113 )
00114 {
00115   x -= pt.x;
00116   y -= pt.y;
00117 }
00118 
00119 inline PLPoint PLPoint::operator -
00120 () const
00121 {
00122   return PLPoint(-x, -y);
00123 }
00124 
00125 inline PLPoint PLPoint::operator +
00126 ( const PLPoint & pt
00127 ) const
00128 {
00129   return PLPoint(x + pt.x, y + pt.y);
00130 }
00131 
00132 inline PLPoint PLPoint::operator -
00133 ( const PLPoint & pt
00134 ) const
00135 {
00136   return PLPoint(x - pt.x, y - pt.y);
00137 }
00138 
00139 inline PLPoint PLPoint::operator /
00140   ( double f
00141   ) const
00142 {
00143   return PLPoint (int(x/f), int(y/f));
00144 }
00145 
00146 #endif
00147 
00148 /*
00149 /--------------------------------------------------------------------
00150 |
00151 |      $Log: plpoint.h,v $
00152 |      Revision 1.8  2002/03/31 13:36:42  uzadow
00153 |      Updated copyright.
00154 |
00155 |      Revision 1.7  2001/10/16 17:12:26  uzadow
00156 |      Added support for resolution information (Luca Piergentili)
00157 |
00158 |      Revision 1.6  2001/09/28 19:50:56  uzadow
00159 |      Added some 24 bpp stuff & other minor features.
00160 |
00161 |      Revision 1.5  2001/09/24 14:18:42  uzadow
00162 |      Added operator -, improved const-correctness.
00163 |
00164 |      Revision 1.4  2001/09/16 19:03:22  uzadow
00165 |      Added global name prefix PL, changed most filenames.
00166 |
00167 |      Revision 1.3  2000/11/21 20:20:36  uzadow
00168 |      Changed bool to bool.
00169 |
00170 |      Revision 1.2  2000/01/10 23:52:59  Ulrich von Zadow
00171 |      Changed formatting & removed tabs.
00172 |
00173 |      Revision 1.1  1999/12/09 16:35:58  Ulrich von Zadow
00174 |      Added PLPoint.
00175 |
00176 |
00177 \--------------------------------------------------------------------
00178 */

Generated on Sun Jun 6 13:42:22 2004 for paintlib by doxygen 1.3.2