00001 00005 #ifndef Cyl_h 00006 #define Cyl_h 00007 00008 #include "Primitive.h" 00009 #include "Point.h" 00010 class Ray; 00011 class Plane; 00012 00013 class Cyl : public Primitive { 00014 public: 00015 Cyl(Material* material, 00016 const Point & base, 00017 const Point & top, 00018 const float rad); 00019 00020 virtual ~Cyl(); 00021 00022 virtual void getBounds(BoundingBox& bbox) const; 00023 virtual void intersect(HitRecord& hit, const RenderContext& context, const Ray& ray) const; 00024 virtual void normal(Vector& normal, const RenderContext& context, 00025 const Point& hitpos, const Ray& ray, const HitRecord& hit) const; 00026 protected: 00027 Point base; 00028 Point top; 00029 float radius; 00030 Vector A; 00031 Plane *basePlane; 00032 Plane *topPlane; 00033 00034 }; 00035 00036 #endif