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