00001 // sphere.h 00002 // 00003 // Copyright (C) 2002, Chris Laurel <claurel@shatters.net> 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 00010 #ifndef _CELMATH_SPHERE_H_ 00011 #define _CELMATH_SPHERE_H_ 00012 00013 #include "vecmath.h" 00014 00015 template<class T> class Sphere 00016 { 00017 public: 00018 Sphere(); 00019 Sphere(T); 00020 Sphere(const Point3<T>&, T); 00021 00022 public: 00023 Point3<T> center; 00024 T radius; 00025 }; 00026 00027 typedef Sphere<float> Spheref; 00028 typedef Sphere<double> Sphered; 00029 00030 00031 template<class T> Sphere<T>::Sphere() : 00032 center(0, 0, 0), radius(1) 00033 { 00034 } 00035 00036 template<class T> Sphere<T>::Sphere(T _radius) : 00037 center(0, 0, 0), radius(_radius) 00038 { 00039 } 00040 00041 template<class T> Sphere<T>::Sphere(const Point3<T>& _center, T _radius) : 00042 center(_center), radius(_radius) 00043 { 00044 } 00045 00046 #endif // _CELMATH_SPHERE_H_ 00047
1.4.1