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