sphere.h
上传用户:center1979
上传日期:2022-07-26
资源大小:50633k
文件大小:1k
源码类别:

OpenGL

开发平台:

Visual C++

  1. // sphere.h
  2. //
  3. // Copyright (C) 2002, Chris Laurel <claurel@shatters.net>
  4. //
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9. #ifndef _CELMATH_SPHERE_H_
  10. #define _CELMATH_SPHERE_H_
  11. #include "vecmath.h"
  12. template<class T> class Sphere
  13. {
  14.  public:
  15.     Sphere();
  16.     Sphere(T);
  17.     Sphere(const Point3<T>&, T);
  18.  
  19.  public:
  20.     Point3<T> center;
  21.     T radius;
  22. };
  23. typedef Sphere<float>   Spheref;
  24. typedef Sphere<double>  Sphered;
  25. template<class T> Sphere<T>::Sphere() :
  26.     center(0, 0, 0), radius(1)
  27. {
  28. }
  29. template<class T> Sphere<T>::Sphere(T _radius) :
  30.     center(0, 0, 0), radius(_radius)
  31. {
  32. }
  33. template<class T> Sphere<T>::Sphere(const Point3<T>& _center, T _radius) :
  34.     center(_center), radius(_radius)
  35. {
  36. }
  37. #endif // _CELMATH_SPHERE_H_