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

intersectionheap.h

00001 /* ************************************************************************* 00002 intersectionheap.h - description 00003 ------------------- 00004 begin : Thu Feb 6 2003 00005 copyright : (C) 2003 by Micha Riser 00006 email : mriser@gmx.net 00007 00008 $Id: intersectionheap_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 INTERSECTIONHEAP_H 00022 #define INTERSECTIONHEAP_H 00023 00024 #include "objectcontainer.h" 00025 00030 class IntersectionHeap { 00031 00032 public: 00033 IntersectionHeap(): size(0) {}; 00034 00035 ~IntersectionHeap() { 00036 for(unsigned int i=1; i<=size; i++) delete(heap[i].intersection); 00037 } 00038 00039 private: 00040 class Node { 00041 public: // Public attributes 00042 Intersection* intersection; 00043 DBL time; 00044 SurfacePatch3D* object; 00045 00046 public: // Constructors 00047 Node() {} 00048 Node(Intersection* i, DBL t, SurfacePatch3D* o): 00049 intersection(i), time(t), object(o) {} 00050 00051 }; 00052 00053 public: 00054 void put(Intersection* i, DBL time_, SurfacePatch3D* o) { 00055 assert(size<ObjectContainer::MAX_MEMBERS_COUNT); 00056 heap[++size] = Node(i,time_,o); 00057 } 00058 00059 Intersection*& intersection() {return heap[1].intersection;} 00060 DBL& time() {return heap[1].time;} 00061 SurfacePatch3D* object() {return heap[1].object;} 00062 SurfacePatch3D* object(int i) {return heap[i].object;} 00063 int getSize() {return size;} 00064 00065 void reassureHeap(); 00066 void build(); 00067 00068 private: 00069 Node heap[ObjectContainer::MAX_MEMBERS_COUNT+1]; 00070 unsigned int size; 00071 00072 }; 00073 00074 #endif

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