00001 /* 00002 File: Sphere.h 00003 00004 Copyright(C) C. Kotterink, Computed Graphics 00005 */ 00006 #ifndef SPHERE_H 00007 #define SPHERE_H 00008 00009 #include<ImplicitShape.h> 00010 00011 #include<Vertex3.h> 00012 #include<real.h> 00013 00016 class Sphere : public ImplicitShape 00017 { 00018 DYNAMIC_OBJECT; 00019 public: 00020 Sphere(Vertex3 position = Vertex3(0.0, 0.0, 0.0), real radius = 1.0); 00021 00022 // Inherited from ImplicitShape 00023 real distance(const Vertex3 &v); 00024 00025 // Inherited from Shape 00026 Vertex3 normal(const Vertex3 &v); 00027 real intersect(const Ray &ray, real t = step, real T = infinity); 00028 00029 // Inherited from DynamicObject 00030 void parseSymbol(Token &t, ObjectFile &file); 00031 void writeParams(ostream &stream); 00032 00033 protected: 00034 // Inherited from DynamicObject 00035 void createSymbols(); 00036 00037 Vertex3 p; 00038 real r; 00039 00040 private: 00041 typedef ImplicitShape super; 00042 }; 00043 #endif