Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Buffer.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Buffer.h	(revision 1025)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Buffer.h	(revision 1526)
@@ -25,6 +25,6 @@
 		inline int length() const { return fill; }
 		inline int maxLength() const { return len; }
+		inline void setFill(int l){fill	=	l;}
 	};
-
 
 	template<class T>
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Heap.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Heap.h	(revision 1025)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Heap.h	(revision 1526)
@@ -16,31 +16,31 @@
 	class Heapable
 	{
-	private:
-		int token;
+		private:
 
-	public:
-		Heapable() { notInHeap(); }
+			int token;
 
-		inline int isInHeap() { return token!=NOT_IN_HEAP; }
-		inline void notInHeap() { token = NOT_IN_HEAP; }
-		inline int getHeapPos() { return token; }
-		inline void setHeapPos(int t) { token=t; }
+		public:
+
+			Heapable() { notInHeap(); }
+
+			inline int isInHeap() { return token!=NOT_IN_HEAP; }
+			inline void notInHeap() { token = NOT_IN_HEAP; }
+			inline int getHeapPos() { return token; }
+			inline void setHeapPos(int t) { token=t; }
 	};
 
+	class heap_node
+	{
+		public:
+			float import;
+			Heapable *obj;
 
-	class heap_node {
-	public:
-		float import;
-		Heapable *obj;
-
-		heap_node() { obj=NULL; import=0.0; }
-		heap_node(Heapable *t, float i=0.0) { obj=t; import=i; }
-		heap_node(const heap_node& h) { import=h.import; obj=h.obj; }
+			heap_node() { obj=NULL; import=0.0; }
+			heap_node(Heapable *t, float i=0.0) { obj=t; import=i; }
+			heap_node(const heap_node& h) { import=h.import; obj=h.obj; }
 	};
 
-
-
-	class Heap : public array<heap_node> {
-
+	class Heap : public array<heap_node>
+	{
 		//
 		// The actual size of the heap.  array::length()
@@ -57,9 +57,8 @@
 		void downheap(int i);
 
-	public:
+		public:
 
 		Heap() { size=0; }
 		Heap(int s) : array<heap_node>(s) { size=0; }
-
 
 		void insert(Heapable *, float);
@@ -67,11 +66,22 @@
 
 		heap_node *extract();
+
+		//	Overhead method.
+		heap_node *extract(int i);
+
 		heap_node *top() { return size<1 ? (heap_node *)NULL : &ref(0); }
 		heap_node *kill(int i);
+
+		//	Gets heap size.
+		int	getSize(){return	size;}
+
+		//	Gets element at position i.
+		heap_node	*getElement(int i){return	&ref(i);}
+
 	};
 
 }
 
-
 // GFXTOOLS_HEAP_INCLUDED
 #endif
+
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Array.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Array.h	(revision 1025)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/Array.h	(revision 1526)
@@ -8,77 +8,76 @@
 {
 	template<class T>
-	class array {
-	protected:
-		T *data;
-		int len;
-	public:
-		array() { data=NULL; len=0; }
-		array(int l) { init(l); }
-		~array() { f_r_e_e(); }
+		class array
+		{
+			protected:
+				T *data;
+				int len;
+			public:
+				array() { data=NULL; len=0; }
+				array(int l) { init(l); }
+				~array() { f_r_e_e(); }
 
+				inline void init(int l);
+				inline void f_r_e_e();
+				inline void resize(int l);
 
-		inline void init(int l);
-		inline void f_r_e_e();
-		inline void resize(int l);
+				inline T& ref(int i);
+				inline T& operator[](int i) { return data[i]; }
+				inline T& operator()(int i) { return ref(i); }
 
-		inline T& ref(int i);
-		inline T& operator[](int i) { return data[i]; }
-		inline T& operator()(int i) { return ref(i); }
+				inline const T& ref(int i) const;
+				inline const T& operator[](int i) const { return data[i]; }
+				inline const T& operator()(int i) const { return ref(i); }
 
-		inline const T& ref(int i) const;
-		inline const T& operator[](int i) const { return data[i]; }
-		inline const T& operator()(int i) const { return ref(i); }
-
-
-		inline int length() const { return len; }
-		inline int maxLength() const { return len; }
-	};
+				inline int length() const { return len; }
+				inline int maxLength() const { return len; }
+		};
 
 	template<class T>
-	inline void array<T>::init(int l)
-	{
-		data = new T[l];
-		len = l;
-	}
+		inline void array<T>::init(int l)
+		{
+			data = new T[l];
+			len = l;
+		}
 
 	template<class T>
-	inline void array<T>::f_r_e_e()
-	{
-		if( data )
+		inline void array<T>::f_r_e_e()
 		{
-		delete[] data;
-		data = NULL;
+			if( data )
+			{
+				delete[] data;
+				data = NULL;
+			}
 		}
-	}
 
 	template<class T>
-	inline T& array<T>::ref(int i)
-	{
-	#ifdef SAFETY
-		assert( data );
-		assert( i>=0 && i<len );
-	#endif
-		return data[i];
-	}
+		inline T& array<T>::ref(int i)
+		{
+#ifdef SAFETY
+			assert( data );
+			assert( i>=0 && i<len );
+#endif
+			return data[i];
+		}
 
 	template<class T>
-	inline const T& array<T>::ref(int i) const
-	{
-	#ifdef SAFETY
-		assert( data );
-		assert( i>=0 && i<len );
-	#endif
-		return data[i];
-	}
+		inline const T& array<T>::ref(int i) const
+		{
+#ifdef SAFETY
+			assert( data );
+			assert( i>=0 && i<len );
+#endif
+			return data[i];
+		}
 
 	template<class T>
-	inline void array<T>::resize(int l)
-	{
-		T *old = data;
-		data = new T[l];
-		data = (T *)memcpy(data,old,MIN(len,l)*sizeof(T));
-		len = l;
-		delete[] old;
-	}
+		inline void array<T>::resize(int l)
+		{
+			T *old = data;
+			data = new T[l];
+			data = (T *)memcpy(data,old,MIN(len,l)*sizeof(T));
+			len = l;
+			delete[] old;
+		}
 }
 
Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/heap.cxx
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/heap.cxx	(revision 1025)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/gfx/tools/heap.cxx	(revision 1526)
@@ -7,115 +7,127 @@
 void Heap::swap(int i,int j)
 {
-    heap_node tmp = ref(i);
+	heap_node tmp = ref(i);
 
-    ref(i) = ref(j);
-    ref(j) = tmp;
+	ref(i) = ref(j);
+	ref(j) = tmp;
 
-    ref(i).obj->setHeapPos(i);
-    ref(j).obj->setHeapPos(j);
+	ref(i).obj->setHeapPos(i);
+	ref(j).obj->setHeapPos(j);
 }
 
 void Heap::upheap(int i)
 {
-    if( i==0 ) return;
+	if( i==0 ) return;
 
-    if( ref(i).import > ref(parent(i)).import ) {
-        swap(i,parent(i));
-        upheap(parent(i));
-    }
+	if( ref(i).import > ref(parent(i)).import )
+	{
+		swap(i,parent(i));
+		upheap(parent(i));
+	}
 }
 
 void Heap::downheap(int i)
 {
-    if (i>=size) return;        // perhaps just extracted the last
+	if (i>=size) return;        // perhaps just extracted the last
 
-    int largest = i,
-        l = left(i),
-        r = right(i);
+	int largest = i,
+			l = left(i),
+			r = right(i);
 
-    if( l<size && ref(l).import > ref(largest).import ) largest = l;
-    if( r<size && ref(r).import > ref(largest).import ) largest = r;
+	if( l<size && ref(l).import > ref(largest).import ) largest = l;
+	if( r<size && ref(r).import > ref(largest).import ) largest = r;
 
-    if( largest != i ) {
-        swap(i,largest);
-        downheap(largest);
-    }
+	if( largest != i ) {
+		swap(i,largest);
+		downheap(largest);
+	}
 }
-
-
 
 void Heap::insert(Heapable *t,float v)
 {
-    if( size == maxLength() )
-    {
-	std::cerr << "NOTE: Growing heap from " << size << " to " << 2*size << std::endl;
-	resize(2*size);
-    }
+	if( size == maxLength() )
+	{
+		std::cerr << "NOTE: Growing heap from " << size << " to " << 2*size << std::endl;
+		resize(2*size);
+	}
 
-    int i = size++;
+	int i = size++;
 
-    ref(i).obj = t;
-    ref(i).import = v;
+	ref(i).obj = t;
+	ref(i).import = v;
 
-    ref(i).obj->setHeapPos(i);
+	ref(i).obj->setHeapPos(i);
 
-    upheap(i);
+	upheap(i);
 }
 
 void Heap::update(Heapable *t,float v)
 {
-    int i = t->getHeapPos();
+	int i = t->getHeapPos();
 
-    if( i >= size )
-    {
+	if( i >= size )
+	{
 		std::cerr << "WARNING: Attempting to update past end of heap!" << std::endl;
 		return;
-    }
-    else if( i == NOT_IN_HEAP )
-    {
+	}
+	else if( i == NOT_IN_HEAP )
+	{
 		std::cerr << "WARNING: Attempting to update object not in heap!" << std::endl;
 		return;
-    }
+	}
 
-    float old=ref(i).import;
-    ref(i).import = v;
+	float old=ref(i).import;
+	ref(i).import = v;
 
-    if( v<old )
-        downheap(i);
-    else
-        upheap(i);
+	if( v<old )
+		downheap(i);
+	else
+		upheap(i);
 }
-
-
 
 heap_node *Heap::extract()
 {
-    if( size<1 ) return 0;
+	if( size<1 ) return 0;
 
-    swap(0,size-1);
-    size--;
+	swap(0,size-1);
+	size--;
 
-    downheap(0);
+	downheap(0);
 
-    ref(size).obj->notInHeap();
+	ref(size).obj->notInHeap();
 
-    return &ref(size);
+	return &ref(size);
+}
+
+//	Overhead method.
+heap_node *Heap::extract(int i)
+{
+	if( size<1 ) return 0;
+
+	swap(i,size-1);
+	size--;
+
+	downheap(i);
+
+	ref(size).obj->notInHeap();
+
+	return &ref(size);
 }
 
 heap_node *Heap::kill(int i)
 {
-    if( i>=size )
+	if( i>=size )
 		std::cerr << "WARNING: Attempt to delete invalid heap node." << std::endl;
 
-    swap(i, size-1);
-    size--;
-    ref(size).obj->notInHeap();
+	swap(i, size-1);
+	size--;
+	ref(size).obj->notInHeap();
 
-    if( ref(i).import < ref(size).import )
+	if( ref(i).import < ref(size).import )
 		downheap(i);
-    else
+	else
 		upheap(i);
 
+	return &ref(size);
+}
 
-    return &ref(size);
-}
