Main Page | Class Hierarchy | Class List | File List | Class Members

cylinder.h

00001 /* ************************************************************************* 00002 cylinder.h - description 00003 ------------------- 00004 begin : Sun Nov 24 2002 00005 copyright : (C) 2002 by Micha Riser 00006 email : mriser@gmx.net 00007 00008 $Id: cylinder_8h-source.html,v 1.1 2005/02/04 21:02:27 micha Exp $ 00009 00010 ************************************************************************* */ 00011 00012 /* ************************************************************************* 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 00018 * * 00019 ************************************************************************* */ 00020 00021 #ifndef CYLINDER_H 00022 #define CYLINDER_H 00023 00024 #include "object3d.h" 00025 #include "intersection.h" 00026 00031 class Cylinder : public Object3D { 00032 00033 public: // Constructors and destructor 00036 Cylinder(); 00037 00040 Cylinder(const Vector3& base, const Vector3& cap, DBL r); 00041 00042 public: // Pulblic methods 00043 00044 // Inherited from Object3D 00045 Object3D* duplicate() const {return new Cylinder(*this);} 00046 00047 Intersection* intersectLocalLimitedTime(const Ray &r, DBL maxtime) const; 00048 bool isInsideAt(const Vector3 &locallocation) const; 00049 00050 private: // Types 00051 enum hittype {SIDE,BASE,CAP,NONE}; 00052 00053 private: // Static members 00054 static HitStatistics stat; 00055 00056 private: // Inner classes 00057 00060 class CylinderIntersection: public Intersection { 00061 00062 private: // Private attributes 00063 DBL currenttime, secondtime; 00064 hittype hit1, hit2; 00065 00066 public: // Constructor and destructor 00067 CylinderIntersection(const Object3D* o, const Ray &r, DBL t1, DBL t2, hittype h1, hittype h2): 00068 Intersection(o,r), currenttime(t1), secondtime(t2), hit1(h1), hit2(h2) {} 00069 00070 public: // Pulblic methods 00071 00072 //Inherited from Intersection 00073 DBL currentTime() {return currenttime;} 00074 void next(); 00075 Vector3 normal(); 00076 00077 }; 00078 00079 private: // Private methods 00080 static DBL absVec2(const Vector3&); 00081 static DBL dotVec2(const Vector3&, const Vector3&); 00082 00083 }; 00084 00085 #endif

Generated on Thu Jan 27 12:16:05 2005 for raytracer.kdevelop by doxygen 1.3.8