nux-0.9.46
|
00001 /* 00002 * Copyright 2010 Inalogic® Inc. 00003 * 00004 * This program is free software: you can redistribute it and/or modify it 00005 * under the terms of the GNU Lesser General Public License, as 00006 * published by the Free Software Foundation; either version 2.1 or 3.0 00007 * of the License. 00008 * 00009 * This program is distributed in the hope that it will be useful, but 00010 * WITHOUT ANY WARRANTY; without even the implied warranties of 00011 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 00012 * PURPOSE. See the applicable version of the GNU Lesser General Public 00013 * License for more details. 00014 * 00015 * You should have received a copy of both the GNU Lesser General Public 00016 * License along with this program. If not, see <http://www.gnu.org/licenses/> 00017 * 00018 * Authored by: Jay Taoko <jaytaoko@inalogic.com> 00019 * 00020 */ 00021 00022 00023 #ifndef POINT2D_H 00024 #define POINT2D_H 00025 00026 namespace nux 00027 { 00028 00029 template<typename T> 00030 class Point2D 00031 { 00032 public: 00033 Point2D(); 00034 ~Point2D(); 00035 Point2D (const Point2D &Pt); 00036 Point2D (T x, T y); 00037 00038 bool operator == (const Point2D<T>& Pt) const; 00039 bool operator != (const Point2D<T>& Pt) const; 00040 00041 void Set (T x, T y); 00042 00043 T x, y; 00044 }; 00045 00046 template<typename T> 00047 Point2D<T>::Point2D() 00048 { 00049 x = 0; 00050 y = 0; 00051 } 00052 00053 template<typename T> 00054 Point2D<T>::~Point2D() 00055 { 00056 } 00057 00058 template<typename T> 00059 Point2D<T>::Point2D (const Point2D &Pt) 00060 { 00061 x = Pt.x; 00062 y = Pt.y; 00063 } 00064 00065 template<typename T> 00066 Point2D<T>::Point2D (T X, T Y) 00067 { 00068 x = X; 00069 y = Y; 00070 } 00071 00072 template<typename T> 00073 void Point2D<T>::Set (T X, T Y) 00074 { 00075 x = X; 00076 y = Y; 00077 } 00078 00079 template<typename T> 00080 bool Point2D<T>::operator == (const Point2D &Pt) const 00081 { 00082 if ( (x == Pt.x) && (y == Pt.y) ) 00083 { 00084 return true; 00085 } 00086 else 00087 { 00088 return false; 00089 } 00090 } 00091 00092 template<typename T> 00093 bool Point2D<T>::operator != (const Point2D &Pt) const 00094 { 00095 return ! ( (*this) == Pt); 00096 } 00097 00098 typedef Point2D<float> Point2; 00099 00100 } 00101 00102 #endif // POINT2D_H