00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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:
00042
Intersection* intersection;
00043 DBL time;
00044
SurfacePatch3D* object;
00045
00046
public:
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