00001 00005 #ifndef Sphere_h 00006 #define Sphere_h 00007 00008 #include "Primitive.h" 00009 #include "Point.h" 00010 class Ray; 00011 00012 class Sphere : public Primitive { 00013 public: 00014 Sphere(Material* material, const Point& center, double radius); 00015 virtual ~Sphere(); 00016 00017 virtual void getBounds(BoundingBox& bbox) const; 00018 virtual void intersect(HitRecord& hit, const RenderContext& context, const Ray& ray) const; 00019 virtual void normal(Vector& normal, const RenderContext& context, 00020 const Point& hitpos, const Ray& ray, const HitRecord& hit) const; 00021 protected: 00022 Point center; 00023 double radius; 00024 double inv_radius; 00025 }; 00026 00027 #endif