00001 /*************************************************************************** 00002 point3d.cpp - description 00003 ------------------- 00004 begin : Tue Mar 15 2005 00005 copyright : (C) 2005-2006 by Ben Swerts 00006 email : bswerts@users.sourceforge.net 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00019 /* 00020 00021 As this is a template class, the implementation is added to the header file. 00022 Here only the static variables are initialized. 00023 00024 */ 00027 00028 #include "point3d.h" 00029 00030 // This is a specialized template class member function 00031 // It only works with GCC and VC++ 7.1 and higher 00032 // -> VC++ needs this routine in the header file, but GCC is fine with 00033 // this file. Check whether GCC allows it in the header file too (probably). 00034 /*#ifdef USE_PARTIAL_SPECIALIZATION 00036 template <> bool Point3D<unsigned int>::operator==(const Point3D& p) const 00038 { 00039 return xCoord == p.xCoord && yCoord == p.yCoord && zCoord == p.zCoord; 00040 } 00041 #endif 00042 */ 00043 00044 00048 // partial specialisation to eliminate Visual C++ complaints about implicit conversions 00049 template <> const float Point3D<float>::PI = 3.14159265358979323846f; 00050 template <> const float Point3D<float>::DEGTORAD = PI/180.0f; 00051 template <> const float Point3D<float>::RADTODEG = 180.0f/PI; 00052 template <> const float Point3D<float>::TOLERANCE = 0.0005f; 00053 00054 template <> const double Point3D<double>::PI = 3.14159265358979323846; 00055 template <> const double Point3D<double>::DEGTORAD = PI/180.0; 00056 template <> const double Point3D<double>::RADTODEG = 180.0/PI; 00057 template <> const double Point3D<double>::TOLERANCE = 0.0005; 00058 00059 // yes, I'm certainly misusing this class... 00060 template <> const unsigned int Point3D<unsigned int>::PI = 1; 00061 template <> const unsigned int Point3D<unsigned int>::DEGTORAD = 1; 00062 template <> const unsigned int Point3D<unsigned int>::RADTODEG = 1; 00063 template <> const unsigned int Point3D<unsigned int>::TOLERANCE = 0; 00064