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 POINT3D_H 00024 #define POINT3D_H 00025 00026 namespace nux 00027 { 00028 00029 template<typename T> 00030 class Point3D 00031 { 00032 public: 00033 Point3D(); 00034 ~Point3D(); 00035 Point3D (const Point3D &Pt); 00036 Point3D (T x, T y, T z); 00037 00038 void Set (T X, T Y, T Z); 00039 bool operator == (const Point3D<T>& Pt) const; 00040 bool operator != (const Point3D<T>& Pt) const; 00041 00042 T x, y, z; 00043 }; 00044 00045 template<typename T> 00046 Point3D<T>::Point3D() 00047 { 00048 x = 0; 00049 y = 0; 00050 z = 0; 00051 } 00052 00053 template<typename T> 00054 Point3D<T>::~Point3D() 00055 { 00056 00057 } 00058 00059 template<typename T> 00060 Point3D<T>::Point3D (const Point3D &Pt) 00061 { 00062 x = Pt.x; 00063 y = Pt.y; 00064 z = Pt.z; 00065 } 00066 00067 template<typename T> 00068 Point3D<T>::Point3D (T X, T Y, T Z) 00069 { 00070 x = X; 00071 y = Y; 00072 z = Z; 00073 } 00074 00075 template<typename T> 00076 void Point3D<T>::Set (T X, T Y, T Z) 00077 { 00078 x = X; 00079 y = Y; 00080 z = Z; 00081 } 00082 00083 template<typename T> 00084 bool Point3D<T>::operator == (const Point3D<T>& Pt) const 00085 { 00086 if ( (x == Pt.x) && 00087 (y == Pt.y) && 00088 (z == Pt.z) ) 00089 { 00090 return true; 00091 } 00092 00093 return false; 00094 } 00095 00096 template<typename T> 00097 bool Point3D<T>::operator != (const Point3D<T>& Pt) const 00098 { 00099 return ! ( (*this) == Pt); 00100 } 00101 00102 typedef Point3D<float> Point3; 00103 00104 } 00105 00106 #endif // POINT3D_H