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

patchobject.h

00001 /* ************************************************************************* 00002 patchobject.h - description 00003 ------------------- 00004 begin : Sun Jan 19 2003 00005 copyright : (C) 2003 by Micha Riser 00006 email : mriser@gmx.net 00007 00008 $Id: patchobject_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 PATCHOBJECT_H 00022 #define PATCHOBJECT_H 00023 00024 #include <vector> 00025 //#include <ext/hash_map> 00026 #include <map> 00027 00028 #include "objectcontainer.h" 00029 00030 class PatchObject: public ObjectContainer { 00031 00032 public: // Constructors and destructors 00033 PatchObject(): ObjectContainer(), insidevector(-PI,-2,4.1) {}; 00034 PatchObject(const Vector3& insidetestvector): ObjectContainer(), insidevector(insidetestvector) {}; 00035 virtual ~PatchObject() {} 00036 00037 protected: 00038 PatchObject(const PatchObject& o): ObjectContainer(o), insidevector(o.insidevector) {}; 00039 00040 public: // Public Methods 00041 00042 // to implement Object3D 00043 Object3D* duplicate() const; 00044 Intersection* intersectLocalLimitedTime(const Ray &r, DBL maxtime) const; 00045 bool isInsideAt(const Vector3 &locallocation) const; 00046 00049 void addPatch(SurfacePatch3D* o); 00050 00051 protected: 00052 // to implement ObjectContainer 00053 ObjectContainer* getEmptyContainer(); 00054 00055 private: 00056 00059 Vector3 insidevector; 00060 00063 static HitStatistics stat; 00064 00065 }; 00066 00067 00068 class SharedPointsPatchObject: public PatchObject { 00069 00070 public: 00071 class Connectivity; 00072 typedef std::vector<Vector3> plist_t; 00073 typedef std::vector<Connectivity*> clist_t; 00074 typedef CNTREF pindex_t; 00075 00076 class Connectivity { // move this class somewhere else 00077 public: 00078 virtual SurfacePatch3D* makePatch(Vector3* pointlist) const = 0; 00079 }; 00080 00081 class TriangleConnectivity: public Connectivity { // move this class somewhere else 00082 public: 00083 TriangleConnectivity(pindex_t A, pindex_t B, pindex_t C); 00084 SurfacePatch3D* makePatch(Vector3* pointlist) const; 00085 private: 00086 pindex_t edge[3]; 00087 }; 00088 00089 class PatchList { 00090 friend class SharedPointsPatchObject; 00091 public: 00092 ~PatchList(); 00093 void addTriangle(const Vector3& A, const Vector3& B, const Vector3& C); 00094 private: 00095 typedef std::map<Vector3,pindex_t> pmap_t; 00096 pmap_t pmap; 00097 clist_t clist; 00098 pindex_t insertPoint(const Vector3&); 00099 }; 00100 00101 public: // Constructor and destructor 00102 SharedPointsPatchObject(const PatchList&); 00103 ~SharedPointsPatchObject(); 00104 00105 private:// Copy constructor 00106 SharedPointsPatchObject(const SharedPointsPatchObject&); 00107 00108 public: // Public methods 00109 00110 // overwrite from PatchObject 00111 Object3D* duplicate() const; 00112 00113 private: // Private attributes 00114 Vector3* pointlist; 00115 CNTREF *pointlistcount; 00116 00117 }; 00118 00119 #endif 00120

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