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

csg.h

00001 /* ************************************************************************* 00002 csg.h - description 00003 ------------------- 00004 begin : Wed Oct 16 2002 00005 copyright : (C) 2002 by Micha Riser 00006 email : mriser@gmx.net 00007 00008 $Id: csg_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 CSG_H 00022 #define CSG_H 00023 00024 #include "objectcontainer.h" 00025 00026 class CSGUnion: public ObjectContainer { 00027 00028 public: // Constructors and destructors 00029 00031 CSGUnion(): ObjectContainer() {} 00032 00034 ~CSGUnion() {} 00035 00036 private: 00038 CSGUnion(const ObjectContainer& o, ObjectList* l): ObjectContainer(o,l) { 00039 calculateBoundingBox(); 00040 } 00041 00043 CSGUnion(const CSGUnion& o): ObjectContainer(o) {} 00044 00045 public: // Public Methods 00046 00047 // to implement SurfacePatch3D 00048 Object3D* duplicate() const {return new CSGUnion(*this);} 00049 00050 // overwrite in Object3D 00051 Object3D* invert() const; 00052 void listInside(const Vector3& location, InsideList& l) const; 00053 Intersection* intersectLocalLimitedTime(const Ray &r, DBL maxtime) const; 00054 bool isInsideAt(const Vector3 &locallocation) const; 00055 00058 void addObject(Object3D* o); 00059 00060 protected: 00062 ObjectContainer* getEmptyContainer(); 00063 00064 private: 00067 static HitStatistics stat; 00068 00069 }; 00070 00071 00072 class CSGMerge: public ObjectContainer { 00073 00074 friend class CSGIntersect; 00075 00076 public: // Constructors and destructors 00077 00079 CSGMerge(): ObjectContainer() {} 00080 00082 ~CSGMerge() {} 00083 00084 private: 00086 CSGMerge(const ObjectContainer& o, ObjectList* l): ObjectContainer(o,l) { 00087 calculateBoundingBox(); 00088 } 00089 00091 CSGMerge(const CSGMerge& o): ObjectContainer(o) {} 00092 00093 public: // Public Methods 00094 00095 // from SurfacePatch3D 00096 Object3D* duplicate() const {return new CSGMerge(*this);} 00097 00098 // overwrite in Object3D 00099 Object3D* invert() const; 00100 Intersection* intersectLocalLimitedTime(const Ray &r, DBL maxtime) const; 00101 bool isInsideAt(const Vector3 &locallocation) const; 00102 00105 void addObject(Object3D* o); 00106 00107 protected: 00108 ObjectContainer* getEmptyContainer(); 00109 00110 private: 00113 static HitStatistics stat; 00114 00115 }; 00116 00117 00118 class CSGIntersect: public ObjectContainer { 00119 00120 friend class CSGUnion; 00121 friend class CSGMerge; 00122 00123 public: // Constructors and destructors 00124 00126 CSGIntersect(): ObjectContainer() {} 00127 00129 ~CSGIntersect() {} 00130 00131 private: 00133 CSGIntersect(const ObjectContainer& o, ObjectList* l): ObjectContainer(o,l) { 00134 calculateBoundingBox(); 00135 } 00136 00138 CSGIntersect(const CSGIntersect& o): ObjectContainer(o) {} 00139 00140 public: // Public Methods 00141 00142 // from SurfacePatch3D 00143 Object3D* duplicate() const {return new CSGIntersect(*this);} 00144 00145 // overwrite in Object3D 00146 Object3D* invert() const; 00147 Intersection* intersectLocalLimitedTime(const Ray &r, DBL maxtime) const; 00148 bool isInsideAt(const Vector3 &locallocation) const; 00149 00152 void addObject(Object3D* o); 00153 00154 protected: 00155 // overwrite in ObjectContainer 00156 void calculateBoundingBox(); 00157 ObjectContainer* getEmptyContainer(); 00158 00159 private: 00162 static HitStatistics stat; 00163 00164 }; 00165 00166 #endif 00167 00168 00169

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