00001 /************************************************************** ggt-head beg 00002 * 00003 * GGT: Generic Graphics Toolkit 00004 * 00005 * Original Authors: 00006 * Allen Bierbaum 00007 * 00008 * ----------------------------------------------------------------- 00009 * File: $RCSfile: Sphere.h,v $ 00010 * Date modified: $Date: 2002/05/20 22:39:22 $ 00011 * Version: $Revision: 1.5 $ 00012 * ----------------------------------------------------------------- 00013 * 00014 *********************************************************** ggt-head end */ 00015 /*************************************************************** ggt-cpr beg 00016 * 00017 * GGT: The Generic Graphics Toolkit 00018 * Copyright (C) 2001,2002 Allen Bierbaum 00019 * 00020 * This library is free software; you can redistribute it and/or 00021 * modify it under the terms of the GNU Lesser General Public 00022 * License as published by the Free Software Foundation; either 00023 * version 2.1 of the License, or (at your option) any later version. 00024 * 00025 * This library is distributed in the hope that it will be useful, 00026 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00027 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00028 * Lesser General Public License for more details. 00029 * 00030 * You should have received a copy of the GNU Lesser General Public 00031 * License along with this library; if not, write to the Free Software 00032 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00033 * 00034 ************************************************************ ggt-cpr end */ 00035 #ifndef _GMTL_SPHERE_H_ 00036 #define _GMTL_SPHERE_H_ 00037 00038 #include <gmtl/Point.h> 00039 00040 namespace gmtl 00041 { 00042 00049 template<class DATA_TYPE> 00050 class Sphere 00051 { 00052 public: 00053 typedef DATA_TYPE DataType; 00054 00055 public: 00059 Sphere() 00060 : mRadius( 0 ) 00061 {} 00062 00069 Sphere( const Point<DATA_TYPE, 3>& center, const DATA_TYPE& radius ) 00070 : mCenter( center ), mRadius( radius ) 00071 {} 00072 00078 Sphere( const Sphere<DATA_TYPE>& sphere ) 00079 : mCenter( sphere.mCenter ), mRadius( sphere.mRadius ) 00080 {} 00081 00087 const Point<DATA_TYPE, 3>& getCenter() const 00088 { 00089 return mCenter; 00090 } 00091 00097 const DATA_TYPE& getRadius() const 00098 { 00099 return mRadius; 00100 } 00101 00107 void setCenter( const Point<DATA_TYPE, 3>& center ) 00108 { 00109 mCenter = center; 00110 } 00111 00117 void setRadius( const DATA_TYPE& radius ) 00118 { 00119 mRadius = radius; 00120 } 00121 00122 public: 00126 Point<DATA_TYPE, 3> mCenter; 00127 00131 DATA_TYPE mRadius; 00132 }; 00133 00134 // --- helper types --- // 00135 typedef Sphere<float> Spheref; 00136 typedef Sphere<double> Sphered; 00137 00138 }; 00139 00140 #endif